lucysrausch / hoverboard-firmware-hack

New Hoverboard Firmware Hack. Now written from scratch and generally much better.
GNU General Public License v3.0
704 stars 407 forks source link

PPM Optimized Firmware? - Request #76

Closed snowkingcro closed 5 years ago

snowkingcro commented 5 years ago

Hi to all, specially Niklas and Jan Henrik - You guys are awesome. I'm building a project for a year now, and the last month i ran the first time on the GPN18 Video on YT. I was amazed how easy all this looks, so i downloaded the repo, flashed my Hoverboard, but when I connect my Rc Receiver (2,4Ghz 3ch), nothing happens. As i'm a noob, i had a hard time to find out how to modify the config.h (and makefile...), but even then, i didn't manage to recompile the Firmware. Followed a few tuts, even with all old and new toolchains, i admit, i don't know how to do it. I wonder if anyone could, Please, post the firmware here - like the bobycar-optimized firmware?

Jana-Marie commented 5 years ago

Posting a precompiled firmware for every possible kind of control input is something that we can't really accomplish. That's because there is a very huge number of possible controls with a even huger number of combinations (inverted motors, inverted steering, switched channels). And even if we would cover that, then the coefficients for speed and steering are not set. Sorry about that. Could you tell us what you have tried and what the errors are you faced? Then we can find a solution together :)

Jana-Marie commented 5 years ago

Oh and thank you for the nice words! :) What kind of project/moving object are you building?

snowkingcro commented 5 years ago

Well, you are real geniuses who made a huge effort and gave it for free... That's te least i can say. I'm trying to make a rc controlled lawnmover. I first started with dc motors from car wipers, but recently saw a hoverboard laying around, so i came up with building just few updates on my frameto mount the motors, it will look something like your armchair, and as soon as i saw that the board has a ppm input, BINGO! So, the hoverboard has 10" wheels, and the speed should be around 4-5km/h, but that can be configured on my rc remote. The main problem is the error 127 that comes up, when i hit "make" I found out (maybe) that this is because the file was compiled on a 32bit machine, and i am trying to recompile with 64bit Ubuntu. The makefile confuses me too, because of the path of the prefix... As i said, i am realy a noob in this area...but i would be greatfull for any help! 😉

snowkingcro commented 5 years ago

Here's a little update, i got back to Windows, pasted the "arm-none-eaby" toolchain folder into the Hoverboard-hack folder, and compiled with cygwin - i think i suceeded. compiled is this something i should get? is the "hover.hex" the file i should flash? Thanks!

Jana-Marie commented 5 years ago

That looks good to me, yep that is the right file.

benjaf commented 5 years ago

The PPM code is unlikely to work for you, if you have a standard 3 channel RC receiver. What is known as PPM in RC is generally only available on high-end 8 channel systems, mainly targeted at drones. It compresses all of the channels into a single 3-wire connector rather than having one connector per channel. This is what is supported by the firmware. What most common receivers use is known as PWM. The duration of the pulse varies between 1 and 2 milliseconds every ~20 milliseconds, and the timing doesn't really matter. Some changes will be required in order to get it to work! One channel should be relatively straightforward, I don't know about 2 or more. But maybe someone else have tried it?

snowkingcro commented 5 years ago

Well, i didn't know that. @benjaf Thanks for the heads up! As i was just up to flashing my board, guess than this https://goo.gl/images/sygfb9 it's going to do nothing at all... I was just hoping that it will be going for two chanels through the ppm, so either both motors fwd, bckwd, or L motor fwd, R motor back...

snowkingcro commented 5 years ago

UPDATE (Again) So, thanks to @benjaf for warning about the Rc Car remote and PPM, i ordered a PPM Encoder. While waiting, i flashed the Niklas's and @Jan--Henrik 's FW, hooked up two 10k potentiometers and played around. The first time i powered the Hoverboard up, left wheel was turning, the right stood still, so i lowered the ADC to 50% in order to prevent the wheel to go to max. Well, i've got some strange results, recorded them for you to see what i got. Two potis on ADC input of the Hoverboard

And here's the code with changed values.

`// ###### CONTROL VIA TWO POTENTIOMETERS ###### // ADC-calibration to cover the full poti-range: connect potis to left sensor board cable (0 to 3.3V) (do NOT use the red 15V wire in the cable!). see . turn the potis to minimum position, write value 1 to ADC1_MIN and value 2 to ADC2_MIN. turn to maximum position and repeat it for ADC?_MAX. make, flash and test it.

define CONTROL_ADC // use ADC as input. disable DEBUG_SERIAL_USART2!

define ADC1_MIN 0 // min ADC1-value while poti at minimum-position (0 - 4095)

define ADC1_MAX 2048 // max ADC1-value while poti at maximum-position (0 - 4095)

define ADC2_MIN 0 // min ADC2-value while poti at minimum-position (0 - 4095)

define ADC2_MAX 2048 // max ADC2-value while poti at maximum-position (0 - 4095)

`

I will try to NOT go offtopic now, but, my arduino is already programed to proces The PWM of the RC Receiver, my question is: Would it be possible to program arduinos output to send voltage to ADC? Then i don't have to mess with PPM encoding and editing the firmware in that way, just only the ADC configuration? Seems to be easyer to me (as a noob).

benjaf commented 5 years ago

You can configure the Arduino to output PWM (No, not the RC sort of PWM) which could be smoothed with a low-pass filter to become an analogue signal. If you REALLY want to try the board with the RC radio before the PPM encoder shows up, I have a fork of this project containing very basic support for RC PWM input. It is still experimental, and will not support steering. But it may get you started.

snowkingcro commented 5 years ago

@benjaf, that's perfect. As for arduino, I'll try a code for PPM decoding, but in meantime, I flashed your FW, it's amazing how good and smooth the throttle is! And it's working on PWM signal! That's what i was actualy searching for, now, the only thing that wonders me, how and where to connect the 2nd chanel for steering? As for steering, i would only need one wheel to turn off. Could the adc1 do this? Just asking...

benjaf commented 5 years ago

@snowkingcro glad it helped! I plan to eventually adapt some of the code from the bbcar fork, it has very smooth throttle response and the option to 'boost' top speed quite a bit. As for adding the steering channel: You'd need to copy and rename several sections of the PWM code if you want to use the transmitter. How difficult this is depends mostly on how comfortable you are with programming. If you want to use ADC, you pretty much just have to include parts of the ADC code in main.c right around line 221 with a few modifications.

snowkingcro commented 5 years ago

Well, if i'd know what to paste and where, i would have no problem to recompile and test, and eventualy to make adjustments 😎 Just one thing that wonders me, in that case - should the ch1 and ch2 be jumpered on the receiver to go with only PPM input?

benjaf commented 5 years ago

I have added steering via PWM to my fork. Beware though, it seems very twitchy to me - it probably needs some filtering. I haven't had time to refine it. You need to connect the signal wire from channel 1 on the receiver to PA2 (the blue wire) on the board, just as you would with ADC input.

Dan9287 commented 5 years ago

Sorry to jump in, but i have been following this and cannot find Ben's fork on github. Im also a total github newb. Im building a tank/skid-steer thing and simply need forward and reverse controlled by nunchuck. Or same control via pwm. Any advice or links i should look at? Thanks in advance and sorry again for hijacking.

On Tue, Feb 5, 2019, 2:29 PM Benjamin notifications@github.com wrote:

I have added steering via PWM to my fork. Beware though, it seems very twitchy to me - it probably needs some filtering. I haven't had time to refine it. You need to connect the signal wire from channel 1 on the receiver to PA3 (the blue wire) on the board, just as you would with ADC input.

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/NiklasFauth/hoverboard-firmware-hack/issues/76#issuecomment-460771466, or mute the thread https://github.com/notifications/unsubscribe-auth/Asx0czHMo3bVof_Xt5g6UM20AGEuN2C8ks5vKdukgaJpZM4aYs8m .

snowkingcro commented 5 years ago

just click on benjafs Avatar, or name, it get's you directly to his github site, and there it is. :)

Dan9287 commented 5 years ago

Idk why that was so difficult for me lol thank you

On Tue, Feb 5, 2019, 4:27 PM snowkingcro notifications@github.com wrote:

just click on benjafs Avatar, or name, it get's you directly to his github site, and there it is. :)

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/NiklasFauth/hoverboard-firmware-hack/issues/76#issuecomment-460810396, or mute the thread https://github.com/notifications/unsubscribe-auth/Asx0cwRLWDhH8B7Izj_RjKp_KwjqYttvks5vKfdRgaJpZM4aYs8m .

snowkingcro commented 5 years ago

I was asuming You are going to do something like this, but sorry, it's not working. :-( Speed is still working, but steer not. i tried to make some combinations and changes on the receiver (didn't touch the code), but nothing helps... below are some pics how i wired it, think therse's nothing wrong... should i maybe play with speed values in config? 20190206_003919 20190206_004249

Dan9287 commented 5 years ago

I AM doing something similar but i dont need steering as i am using two motherboards for a skid-steer style vehicle. So as long as there is forward, brake, and reverse, my FrSky Qx7 transmitter can easily do the channel mixing on its own. I'll have 16ch at my disposal.

On Tue, Feb 5, 2019, 6:54 PM snowkingcro notifications@github.com wrote:

I was asuming You are going to do something like this, but sorry, it's not working. :-( Speed is still working, but steer not. i tried to make some combinations and changes on the receiver (didn't touch the code), but nothing helps... below are some pics how i wired it, think therse's nothing wrong... should i maybe play with speed values in config? [image: 20190206_003919] https://user-images.githubusercontent.com/46979217/52312116-b090c400-29a9-11e9-91f2-52d3b62d0595.jpg [image: 20190206_004249] https://user-images.githubusercontent.com/46979217/52312117-b1295a80-29a9-11e9-9eeb-813d42a7ec96.jpg

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/NiklasFauth/hoverboard-firmware-hack/issues/76#issuecomment-460851744, or mute the thread https://github.com/notifications/unsubscribe-auth/Asx0c94gGX5FZrsvhbTsKJg6hUY-x9JAks5vKhmzgaJpZM4aYs8m .

benjaf commented 5 years ago

@snowkingcro The wiring looks fine to me. It was rather erratic on my board too, sometimes working and sometimes not. I'm not sure if the timer I used for the steering channel might be in use somewhere else as well. Try disabling DEBUG_SERIAL_USART3 in config.h and see if that helps?

Dan9287 commented 5 years ago

i was able to get both pwm(not including steering) and nunchuck control working decently, i just need to revers one motor or the other and i am unsure of how to do that in the code. ive done what i thought made sense and no dice.

On Wed, Feb 6, 2019 at 2:43 AM Benjamin notifications@github.com wrote:

@snowkingcro https://github.com/snowkingcro The wiring looks fine to me. It was rather erratic on my board too, sometimes working and sometimes not. I'm not sure if the timer I used for the steering channel might be in use somewhere else as well. Try disabling DEBUG_SERIAL_USART3 in config.h and see if that helps?

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/NiklasFauth/hoverboard-firmware-hack/issues/76#issuecomment-460928951, or mute the thread https://github.com/notifications/unsubscribe-auth/Asx0c2VIy1T1X9MAA6bfXgHe1tesTtbUks5vKoeRgaJpZM4aYs8m .

benjaf commented 5 years ago

@Dan9287 Setting SPEED_COEFFICIENT to -1 should reverse the direction

p-h-a-i-l commented 5 years ago

I think the proper way to invert is deactivating or activating these settings: https://github.com/NiklasFauth/hoverboard-firmware-hack/blob/9beae76952119e3bb3e367d43a307f4ac420c6e4/Inc/config.h#L90-L91

snowkingcro commented 5 years ago

I'm struggling half of the day to recompile after disabling DEBUG_SERIAL_USART3... getting ERROR 139, as i saw that you are using the sam toolchain like me, im now completly lost... i don't know how cygwin works on the master repo, and on your fork not... 😩😩 I guess, I'll just wait for my PPM decoder to arrive. I realy appreciate all work that @benjaf done, and man, thank you very much!

Dan9287 commented 5 years ago

@snowkingcro/benjaf you guys have both helped me out immensely. Ive nailed down most of MY issues with disabling steering and getting both motors to behave the same, what ive run into now is, actual controls are backwards. Pushing forward on the nunchuck results in reverse movement along with the "backup beeps". Is there a way to invert control? Again MAJOR thanks to both of you!

On Wed, Feb 6, 2019, 12:19 PM snowkingcro notifications@github.com wrote:

I'm struggling half of the day to recompile after disabling DEBUG_SERIAL_USART3... getting ERROR 139, as i saw that you are using the sam toolchain like me, im now completly lost... i don't know how cygwin works on the master repo, and on your fork not... 😩😩 I guess, I'll just wait for my PPM decoder to arrive. I realy appreciate all work that @benjaf https://github.com/benjaf done, and man, thank you very much!

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/NiklasFauth/hoverboard-firmware-hack/issues/76#issuecomment-461108442, or mute the thread https://github.com/notifications/unsubscribe-auth/Asx0c7fbCEZWso42suPo_3XcR0ZgVa0rks5vKw64gaJpZM4aYs8m .

Dan9287 commented 5 years ago

Got it sorted. Thanks again for the input!

On Wed, Feb 6, 2019, 6:20 PM Daniel Blue dan9287@gmail.com wrote:

@snowkingcro/benjaf you guys have both helped me out immensely. Ive nailed down most of MY issues with disabling steering and getting both motors to behave the same, what ive run into now is, actual controls are backwards. Pushing forward on the nunchuck results in reverse movement along with the "backup beeps". Is there a way to invert control? Again MAJOR thanks to both of you!

On Wed, Feb 6, 2019, 12:19 PM snowkingcro notifications@github.com wrote:

I'm struggling half of the day to recompile after disabling DEBUG_SERIAL_USART3... getting ERROR 139, as i saw that you are using the sam toolchain like me, im now completly lost... i don't know how cygwin works on the master repo, and on your fork not... 😩😩 I guess, I'll just wait for my PPM decoder to arrive. I realy appreciate all work that @benjaf https://github.com/benjaf done, and man, thank you very much!

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/NiklasFauth/hoverboard-firmware-hack/issues/76#issuecomment-461108442, or mute the thread https://github.com/notifications/unsubscribe-auth/Asx0c7fbCEZWso42suPo_3XcR0ZgVa0rks5vKw64gaJpZM4aYs8m .

p-h-a-i-l commented 5 years ago

what did you change?

Dan9287 commented 5 years ago

@p-h-a-i-l im trying to figure out what i did to reverse the nunchuck control, im not entirely sure. i was very sleepy and just trying things til something worked. here are my main, and config files so you can have a look. if you can figure out what i did please let me know lol

On Thu, Feb 7, 2019 at 2:17 AM p-h-a-i-l notifications@github.com wrote:

what did you change?

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/NiklasFauth/hoverboard-firmware-hack/issues/76#issuecomment-461312020, or mute the thread https://github.com/notifications/unsubscribe-auth/Asx0cxfzzfO-9I52yBwxq-qtZA2sE3Jhks5vK9LwgaJpZM4aYs8m .

/*

include "stm32f1xx_hal.h"

include "defines.h"

include "setup.h"

include "config.h"

//#include "hd44780.h"

void SystemClock_Config(void);

extern TIM_HandleTypeDef htim_left; extern TIM_HandleTypeDef htim_right; extern ADC_HandleTypeDef hadc1; extern ADC_HandleTypeDef hadc2; extern volatile adc_buf_t adc_buffer; //LCD_PCF8574_HandleTypeDef lcd; extern I2C_HandleTypeDef hi2c2; extern UART_HandleTypeDef huart2;

int cmd1; // normalized input values. -1000 to 1000 int cmd2; int cmd3;

typedef struct{ int16_t steer; int16_t speed; //uint32_t crc; } Serialcommand;

volatile Serialcommand command;

uint8_t button1, button2;

int steer; // global variable for steering. -1000 to 1000 int speed; // global variable for speed. -1000 to 1000

extern volatile int pwml; // global variable for pwm left. -1000 to 1000 extern volatile int pwmr; // global variable for pwm right. -1000 to 1000 extern volatile int weakl; // global variable for field weakening left. -1000 to 1000 extern volatile int weakr; // global variable for field weakening right. -1000 to 1000

extern uint8_t buzzerFreq; // global variable for the buzzer pitch. can be 1, 2, 3, 4, 5, 6, 7... extern uint8_t buzzerPattern; // global variable for the buzzer pattern. can be 1, 2, 3, 4, 5, 6, 7...

extern uint8_t enable; // global variable for motor enable

extern volatile uint32_t timeout; // global variable for timeout extern float batteryVoltage; // global variable for battery voltage

uint32_t inactivity_timeout_counter;

extern uint8_t nunchuck_data[6];

ifdef CONTROL_PPM

extern volatile uint16_t ppm_captured_value[PPM_NUM_CHANNELS+1];

endif

int milli_vel_error_sum = 0;

void poweroff() { if (abs(speed) < 20) { buzzerPattern = 0; enable = 0; for (int i = 0; i < 8; i++) { buzzerFreq = i; HAL_Delay(100); } HAL_GPIO_WritePin(OFF_PORT, OFF_PIN, 0); while(1) {} } }

int main(void) { HAL_Init(); __HAL_RCC_AFIO_CLK_ENABLE(); HAL_NVIC_SetPriorityGrouping(NVIC_PRIORITYGROUP_4); / System interrupt init/ / MemoryManagement_IRQn interrupt configuration / HAL_NVIC_SetPriority(MemoryManagement_IRQn, 0, 0); / BusFault_IRQn interrupt configuration / HAL_NVIC_SetPriority(BusFault_IRQn, 0, 0); / UsageFault_IRQn interrupt configuration / HAL_NVIC_SetPriority(UsageFault_IRQn, 0, 0); / SVCall_IRQn interrupt configuration / HAL_NVIC_SetPriority(SVCall_IRQn, 0, 0); / DebugMonitor_IRQn interrupt configuration / HAL_NVIC_SetPriority(DebugMonitor_IRQn, 0, 0); / PendSV_IRQn interrupt configuration / HAL_NVIC_SetPriority(PendSV_IRQn, 0, 0); / SysTick_IRQn interrupt configuration / HAL_NVIC_SetPriority(SysTick_IRQn, 0, 0);

SystemClock_Config();

__HAL_RCC_DMA1_CLK_DISABLE(); MX_GPIO_Init(); MX_TIM_Init(); MX_ADC1_Init(); MX_ADC2_Init();

if defined(DEBUG_SERIAL_USART2) || defined(DEBUG_SERIAL_USART3)

UART_Init();

endif

HAL_GPIO_WritePin(OFF_PORT, OFF_PIN, 1);

HAL_ADC_Start(&hadc1); HAL_ADC_Start(&hadc2);

for (int i = 8; i >= 0; i--) { buzzerFreq = i; HAL_Delay(100); } buzzerFreq = 0;

HAL_GPIO_WritePin(LED_PORT, LED_PIN, 1);

int lastSpeedL = 0, lastSpeedR = 0; int speedL = 0, speedR = 0; float direction = 1;

ifdef CONTROL_PPM

PPM_Init();

endif

ifdef CONTROL_NUNCHUCK

I2C_Init();
Nunchuck_Init();

endif

ifdef CONTROL_SERIAL_USART2

UART_Control_Init();
HAL_UART_Receive_DMA(&huart2, (uint8_t *)&command, 4);

endif

ifdef DEBUG_I2C_LCD

I2C_Init();
HAL_Delay(50);
lcd.pcf8574.PCF_I2C_ADDRESS = 0x27;
  lcd.pcf8574.PCF_I2C_TIMEOUT = 5;
  lcd.pcf8574.i2c = hi2c2;
  lcd.NUMBER_OF_LINES = NUMBER_OF_LINES_2;
  lcd.type = TYPE0;

  if(LCD_Init(&lcd)!=LCD_OK){
      // error occured
      //TODO while(1);
  }

LCD_ClearDisplay(&lcd);
HAL_Delay(5);
LCD_SetLocation(&lcd, 0, 0);
LCD_WriteString(&lcd, "Hover V2.0");
LCD_SetLocation(&lcd, 0, 1);
LCD_WriteString(&lcd, "Initializing...");

endif

float board_temp_adc_filtered = (float)adc_buffer.temp; float board_temp_deg_c;

enable = 1; // enable motors

while(1) { HAL_Delay(DELAY_IN_MAIN_LOOP); //delay in ms

#ifdef CONTROL_NUNCHUCK
  Nunchuck_Read();
  cmd1 = CLAMP((nunchuck_data[0] - 127) * 8, -1000, 1000); // x - axis. Nunchuck joystick readings range 30 - 230
  cmd2 = CLAMP((nunchuck_data[1] - 128) * 8, -1000, 1000); // y - axis

  button1 = (uint8_t)nunchuck_data[5] & 1;
  button2 = (uint8_t)(nunchuck_data[5] >> 1) & 1;
#endif

#ifdef CONTROL_PPM
  cmd1 = CLAMP((ppm_captured_value[0] - 500) * 2, -1000, 1000);
  cmd2 = CLAMP((ppm_captured_value[1] - 500) * 2, -1000, 1000);
  button1 = ppm_captured_value[5] > 500;
  float scale = ppm_captured_value[2] / 1000.0f;
#endif

#ifdef CONTROL_ADC
  // ADC values range: 0-4095, see ADC-calibration in config.h
  cmd1 = CLAMP(adc_buffer.l_tx2 - ADC1_MIN, 0, ADC1_MAX) / (ADC1_MAX / 1000.0f);  // ADC1
  cmd2 = CLAMP(adc_buffer.l_rx2 - ADC2_MIN, 0, ADC2_MAX) / (ADC2_MAX / 1000.0f);  // ADC2

  // use ADCs as button inputs:
  button1 = (uint8_t)(adc_buffer.l_tx2 > 2000);  // ADC1
  button2 = (uint8_t)(adc_buffer.l_rx2 > 2000);  // ADC2

  timeout = 0;
#endif

#ifdef CONTROL_SERIAL_USART2
  cmd1 = CLAMP((int16_t)command.steer, -1000, 1000);
  cmd2 = CLAMP((int16_t)command.speed, -1000, 1000);

  timeout = 0;
#endif

// ####### LOW-PASS FILTER #######
steer = steer * (1.0 - FILTER) + 0 * FILTER;
speed = speed * (1.0 - FILTER) + (cmd2*1) * FILTER;

// ####### MIXER #######
speedR = CLAMP(speed * SPEED_COEFFICIENT , -1000, 1000);
speedL = CLAMP(speed * SPEED_COEFFICIENT , -1000, 1000);

#ifdef ADDITIONAL_CODE
  ADDITIONAL_CODE;
#endif

// ####### SET OUTPUTS #######
if ((speedL < lastSpeedL + 50 && speedL > lastSpeedL - 50) && (speedR < lastSpeedR + 50 && speedR > lastSpeedR - 50) && timeout < TIMEOUT) {
#ifdef INVERT_R_DIRECTION
  pwmr = -speedR;
#else
  pwmr = speedR;
#endif
#ifdef INVERT_L_DIRECTION
  pwml = -speedL;
#else
  pwml = speedL;
#endif
}

lastSpeedL = speedL;
lastSpeedR = speedR;

if (inactivity_timeout_counter % 25 == 0) {
  // ####### CALC BOARD TEMPERATURE #######
  board_temp_adc_filtered = board_temp_adc_filtered * 0.99 + (float)adc_buffer.temp * 0.01;
  board_temp_deg_c = ((float)TEMP_CAL_HIGH_DEG_C - (float)TEMP_CAL_LOW_DEG_C) / ((float)TEMP_CAL_HIGH_ADC - (float)TEMP_CAL_LOW_ADC) * (board_temp_adc_filtered - (float)TEMP_CAL_LOW_ADC) + (float)TEMP_CAL_LOW_DEG_C;

  // ####### DEBUG SERIAL OUT #######
  #ifdef CONTROL_ADC
    setScopeChannel(0, (int)adc_buffer.l_tx2);  // 1: ADC1
    setScopeChannel(1, (int)adc_buffer.l_rx2);  // 2: ADC2
  #endif
  setScopeChannel(2, (int)speedR);  // 3: output speed: 0-1000
  setScopeChannel(3, (int)speedL);  // 4: output speed: 0-1000
  setScopeChannel(4, (int)adc_buffer.batt1);  // 5: for battery voltage calibration
  setScopeChannel(5, (int)(batteryVoltage * 100.0f));  // 6: for verifying battery voltage calibration
  setScopeChannel(6, (int)board_temp_adc_filtered);  // 7: for board temperature calibration
  setScopeChannel(7, (int)board_temp_deg_c);  // 8: for verifying board temperature calibration
  consoleScope();
}

// ####### POWEROFF BY POWER-BUTTON #######
if (HAL_GPIO_ReadPin(BUTTON_PORT, BUTTON_PIN) && weakr == 0 && weakl == 0) {
  enable = 0;
  while (HAL_GPIO_ReadPin(BUTTON_PORT, BUTTON_PIN)) {}
  poweroff();
}

// ####### BEEP AND EMERGENCY POWEROFF #######
if ((TEMP_POWEROFF_ENABLE && board_temp_deg_c >= TEMP_POWEROFF && abs(speed) < 20) || (batteryVoltage < ((float)BAT_LOW_DEAD * (float)BAT_NUMBER_OF_CELLS) && abs(speed) < 20)) {  // poweroff before mainboard burns OR low bat 3
  poweroff();
} else if (TEMP_WARNING_ENABLE && board_temp_deg_c >= TEMP_WARNING) {  // beep if mainboard gets hot
  buzzerFreq = 4;
  buzzerPattern = 1;
} else if (batteryVoltage < ((float)BAT_LOW_LVL1 * (float)BAT_NUMBER_OF_CELLS) && batteryVoltage > ((float)BAT_LOW_LVL2 * (float)BAT_NUMBER_OF_CELLS) && BAT_LOW_LVL1_ENABLE) {  // low bat 1: slow beep
  buzzerFreq = 5;
  buzzerPattern = 42;
} else if (batteryVoltage < ((float)BAT_LOW_LVL2 * (float)BAT_NUMBER_OF_CELLS) && batteryVoltage > ((float)BAT_LOW_DEAD * (float)BAT_NUMBER_OF_CELLS) && BAT_LOW_LVL2_ENABLE) {  // low bat 2: fast beep
  buzzerFreq = 5;
  buzzerPattern = 6;
} else if (BEEPS_BACKWARD && speed < -50) {  // backward beep
  buzzerFreq = 5;
  buzzerPattern = 1;
} else {  // do not beep
  buzzerFreq = 0;
  buzzerPattern = 0;
}

// ####### INACTIVITY TIMEOUT #######
if (abs(speedL) > 50 || abs(speedR) > 50) {
  inactivity_timeout_counter = 0;
} else {
  inactivity_timeout_counter ++;
}
if (inactivity_timeout_counter > (INACTIVITY_TIMEOUT * 60 * 1000) / (DELAY_IN_MAIN_LOOP + 1)) {  // rest of main loop needs maybe 1ms
  poweroff();
}

} }

/* System Clock Configuration / void SystemClock_Config(void) { RCC_OscInitTypeDef RCC_OscInitStruct; RCC_ClkInitTypeDef RCC_ClkInitStruct; RCC_PeriphCLKInitTypeDef PeriphClkInit;

/*Initializes the CPU, AHB and APB busses clocks / RCC_OscInitStruct.OscillatorType = RCC_OSCILLATORTYPE_HSI; RCC_OscInitStruct.HSIState = RCC_HSI_ON; RCC_OscInitStruct.HSICalibrationValue = 16; RCC_OscInitStruct.PLL.PLLState = RCC_PLL_ON; RCC_OscInitStruct.PLL.PLLSource = RCC_PLLSOURCE_HSI_DIV2; RCC_OscInitStruct.PLL.PLLMUL = RCC_PLL_MUL16; HAL_RCC_OscConfig(&RCC_OscInitStruct);

/*Initializes the CPU, AHB and APB busses clocks / RCC_ClkInitStruct.ClockType = RCC_CLOCKTYPE_HCLK | RCC_CLOCKTYPE_SYSCLK | RCC_CLOCKTYPE_PCLK1 | RCC_CLOCKTYPE_PCLK2; RCC_ClkInitStruct.SYSCLKSource = RCC_SYSCLKSOURCE_PLLCLK; RCC_ClkInitStruct.AHBCLKDivider = RCC_SYSCLK_DIV1; RCC_ClkInitStruct.APB1CLKDivider = RCC_HCLK_DIV2; RCC_ClkInitStruct.APB2CLKDivider = RCC_HCLK_DIV1;

HAL_RCC_ClockConfig(&RCC_ClkInitStruct, FLASH_LATENCY_2);

PeriphClkInit.PeriphClockSelection = RCC_PERIPHCLK_ADC; PeriphClkInit.AdcClockSelection = RCC_ADCPCLK2_DIV8; // 8 MHz HAL_RCCEx_PeriphCLKConfig(&PeriphClkInit);

/*Configure the Systick interrupt time / HAL_SYSTICK_Config(HAL_RCC_GetHCLKFreq() / 1000);

/*Configure the Systick / HAL_SYSTICK_CLKSourceConfig(SYSTICK_CLKSOURCE_HCLK);

/ SysTick_IRQn interrupt configuration / HAL_NVIC_SetPriority(SysTick_IRQn, 0, 0); }

pragma once

include "stm32f1xx_hal.h"

// ############################### DO-NOT-TOUCH SETTINGS ###############################

define PWM_FREQ 16000 // PWM frequency in Hz

define DEAD_TIME 32 // PWM deadtime

define DELAY_IN_MAIN_LOOP 5 // in ms. default 5. it is independent of all the timing critical stuff. do not touch if you do not know what you are doing.

define TIMEOUT 5 // number of wrong / missing input commands before emergency off

// ############################### GENERAL ###############################

// How to calibrate: connect GND and RX of a 3.3v uart-usb adapter to the right sensor board cable (be careful not to use the red wire of the cable. 15v will destroye verything.). if you are using nunchuck, disable it temporarily. enable DEBUG_SERIAL_USART3 and DEBUG_SERIAL_ASCII use asearial terminal.

// Battery voltage calibration: connect power source. see . write value nr 5 to BAT_CALIB_ADC. make and flash firmware. then you can verify voltage on value 6 (devide it by 100.0 to get calibrated voltage).

define BAT_CALIB_REAL_VOLTAGE 43.0 // input voltage measured by multimeter

define BAT_CALIB_ADC 1704 // adc-value measured by mainboard (value nr 5 on UART debug output)

define BAT_NUMBER_OF_CELLS 10 // normal Hoverboard battery: 10s

define BAT_LOW_LVL1_ENABLE 0 // to beep or not to beep, 1 or 0

define BAT_LOW_LVL1 3.6 // gently beeps at this voltage level. [V/cell]

define BAT_LOW_LVL2_ENABLE 1 // to beep or not to beep, 1 or 0

define BAT_LOW_LVL2 3.5 // your battery is almost empty. Charge now! [V/cell]

define BAT_LOW_DEAD 3.37 // undervoltage poweroff. (while not driving) [V/cell]

define DC_CUR_LIMIT 15 // DC current limit in amps per motor. so 15 means it will draw 30A out of your battery. it does not disable motors, it is a soft current limit.

// Board overheat detection: the sensor is inside the STM/GD chip. it is very inaccurate without calibration (up to 45°C). so only enable this funcion after calibration! let your board cool down. see . get the real temp of the chip by thermo cam or another temp-sensor taped on top of the chip and write it to TEMP_CAL_LOW_DEG_C. write debug value 8 to TEMP_CAL_LOW_ADC. drive around to warm up the board. it should be at least 20°C warmer. repeat it for the HIGH-values. enable warning and/or poweroff and make and flash firmware.

define TEMP_CAL_LOW_ADC 1655 // temperature 1: ADC value

define TEMP_CAL_LOW_DEG_C 35.8 // temperature 1: measured temperature [°C]

define TEMP_CAL_HIGH_ADC 1588 // temperature 2: ADC value

define TEMP_CAL_HIGH_DEG_C 48.9 // temperature 2: measured temperature [°C]

define TEMP_WARNING_ENABLE 0 // to beep or not to beep, 1 or 0, DO NOT ACTIVITE WITHOUT CALIBRATION!

define TEMP_WARNING 60 // annoying fast beeps [°C]

define TEMP_POWEROFF_ENABLE 0 // to poweroff or not to poweroff, 1 or 0, DO NOT ACTIVITE WITHOUT CALIBRATION!

define TEMP_POWEROFF 65 // overheat poweroff. (while not driving) [°C]

define INACTIVITY_TIMEOUT 8 // minutes of not driving until poweroff. it is not very precise.

// ############################### LCD DEBUG ###############################

//#define DEBUG_I2C_LCD // standard 16x2 or larger text-lcd via i2c-converter on right sensor board cable

// ############################### SERIAL DEBUG ###############################

//#define DEBUG_SERIAL_USART3 // right sensor board cable, disable if I2C (nunchuck or lcd) is used!

define DEBUG_BAUD 115200 // UART baud rate

//#define DEBUG_SERIAL_SERVOTERM

define DEBUG_SERIAL_ASCII // "1:345 2:1337 3:0 4:0 5:0 6:0 7:0 8:0\r\n"

// ############################### INPUT ###############################

// ###### CONTROL VIA UART (serial) ###### //#define CONTROL_SERIAL_USART2 // left sensor board cable, disable if ADC or PPM is used!

define CONTROL_BAUD 19200 // control via usart from eg an Arduino or raspberry

// for Arduino, use void loop(void){ Serial.write((uint8_t ) &steer, sizeof(steer)); Serial.write((uint8_t ) &speed, sizeof(speed));delay(20); }

// ###### CONTROL VIA RC REMOTE ###### // left sensor board cable. Channel 1: steering, Channel 2: speed. //#define CONTROL_PPM // use PPM-Sum as input. disable DEBUG_SERIAL_USART2! //#define PPM_NUM_CHANNELS 6 // total number of PPM channels to receive, even if they are not used.

// ###### CONTROL VIA TWO POTENTIOMETERS ###### // ADC-calibration to cover the full poti-range: connect potis to left sensor board cable (0 to 3.3V) (do NOT use the red 15V wire in the cable!). see . turn the potis to minimum position, write value 1 to ADC1_MIN and value 2 to ADC2_MIN. turn to maximum position and repeat it for ADC?_MAX. make, flash and test it. //#define CONTROL_ADC // use ADC as input. disable DEBUG_SERIAL_USART2! //#define ADC1_MIN 0 // min ADC1-value while poti at minimum-position (0 - 4095) //#define ADC1_MAX 4095 // max ADC1-value while poti at maximum-position (0 - 4095) //#define ADC2_MIN 0 // min ADC2-value while poti at minimum-position (0 - 4095) //#define ADC2_MAX 4095 // max ADC2-value while poti at maximum-position (0 - 4095)

// ###### CONTROL VIA NINTENDO NUNCHUCK ###### // left sensor board cable. keep cable short, use shielded cable, use ferrits, stabalize voltage in nunchuck, use the right one of the 2 types of nunchucks, add i2c pullups. use original nunchuck. most clones does not work very well.

define CONTROL_NUNCHUCK // use nunchuck as input. disable DEBUG_SERIAL_USART3!

// ############################### DRIVING BEHAVIOR ###############################

// inputs: // - cmd1 and cmd2: analog normalized input values. -1000 to 1000 // - button1 and button2: digital input values. 0 or 1 // - adc_buffer.l_tx2 and adc_buffer.l_rx2: unfiltered ADC values (you do not need them). 0 to 4095 // outputs: // - speedR and speedL: normal driving -1000 to 1000 // - weakr and weakl: field weakening for extra boost at high speed (speedR > 700 and speedL > 700). 0 to ~400

define FILTER 1.0 // lower value == softer filter. do not use values <0.01, you will get float precision issues.

define SPEED_COEFFICIENT -1.8 // higher value == stronger. 0.0 to ~2.0?

define STEER_COEFFICIENT 0.0 // higher value == stronger. if you do not want any steering, set it to 0.0; 0.0 to 1.0

define INVERT_R_DIRECTION

define INVERT_L_DIRECTION

define BEEPS_BACKWARD 1 // 0 or 1

//Turbo boost at high speeds while button1 is pressed: //#define ADDITIONAL_CODE \ if (button1 && speedR > 700) { / field weakening at high speeds / \ weakl = cmd1 - 700; / weak should never exceed 400 or 450 MAX!! / \ weakr = cmd1 - 700; } \ else { \ weakl = 0; \ weakr = 0; }

// ###### SIMPLE BOBBYCAR ###### // for better bobbycar code see: https://github.com/larsmm/hoverboard-firmware-hack-bbcar // #define FILTER 0.1 // #define SPEED_COEFFICIENT -1 // #define STEER_COEFFICIENT 0

// #define ADDITIONAL_CODE \ if (button1 && speedR < 300) { / drive backwards / \ speedR = speedR -0.2f; \ speedL = speedL -0.2f; } \ else { \ direction = 1; } \ if (button1 && speedR > 700) { / field weakening at high speeds / \ weakl = speedR - 600; / weak should never exceed 400 or 450 MAX!! / \ weakr = speedR - 600; } \ else { \ weakl = 0; \ weakr = 0; }

// ###### ARMCHAIR ###### // #define FILTER 0.05 // #define SPEED_COEFFICIENT 0.5 // #define STEER_COEFFICIENT -0.2

// #define ADDITIONAL_CODE if (button1 && scale > 0.8) { / field weakening at high speeds / \ weakl = speedL - 600; / weak should never exceed 400 or 450 MAX!! / \ weakr = speedR - 600; } \ else {\ weakl = 0;\ weakr = 0;

// ############################### VALIDATE SETTINGS ###############################

if defined CONTROL_SERIAL_USART2 && defined CONTROL_ADC

error CONTROL_ADC and CONTROL_SERIAL_USART2 not allowed. it is on the same cable.

endif

if defined CONTROL_SERIAL_USART2 && defined CONTROL_PPM

error CONTROL_PPM and CONTROL_SERIAL_USART2 not allowed. it is on the same cable.

endif

if defined DEBUG_SERIAL_USART3 && defined CONTROL_NUNCHUCK

error CONTROL_NUNCHUCK and DEBUG_SERIAL_USART3 not allowed. it is on the same cable.

endif

if defined DEBUG_SERIAL_USART3 && defined DEBUG_I2C_LCD

error DEBUG_I2C_LCD and DEBUG_SERIAL_USART3 not allowed. it is on the same cable.

endif

if defined CONTROL_PPM && defined CONTROL_ADC && defined CONTROL_NUNCHUCK || defined CONTROL_PPM && defined CONTROL_ADC || defined CONTROL_ADC && defined CONTROL_NUNCHUCK || defined CONTROL_PPM && defined CONTROL_NUNCHUCK

error only 1 input method allowed. use CONTROL_PPM or CONTROL_ADC or CONTROL_NUNCHUCK.

endif

p-h-a-i-l commented 5 years ago

;) I was just asking for future googlers. It's always annoying to find old postings describing your problem without a solution.

p-h-a-i-l commented 5 years ago

ok, here is what you did :)

in main.c you reversed pwmr (could have done the same by removing #define INVERT_R_DIRECTION from config.h it would look like this:

//#define INVERT_R_DIRECTION
#define INVERT_L_DIRECTION

(the other changes to your main.c do not really do anything :) )

your speed coefficient is negative in config.c so this is again changing the state of both INVERT_R_DIRECTION and INVERT_L_DIRECTION.

so your config would now be like:

[...]
//#define CONTROL_ADC                 // use ADC as input. disable DEBUG_SERIAL_USART2!
[...]
#define CONTROL_NUNCHUCK            // use nunchuck as input. disable DEBUG_SERIAL_USART3!
[...]
#define FILTER              1.0  // lower value == softer filter. do not use values <0.01, you will get float precision issues.
#define SPEED_COEFFICIENT   1.8  // higher value == stronger. 0.0 to ~2.0?
#define STEER_COEFFICIENT   0.0  // higher value == stronger. if you do not want any steering, set it to 0.0; 0.0 to 1.0
#define INVERT_R_DIRECTION
//#define INVERT_L_DIRECTION
#define BEEPS_BACKWARD 1    // 0 or 1
[...]

with a clean repo and the config above you should get the same behaviour

Dan9287 commented 5 years ago

when i commented "invert_" on either motor i always got clock skew errors, or it had no effect. but then again im literally stumbling through this not having REAL suitable experience so idk lol my thing was that when pushing forward on the nunchuck, motors were in reverse, and i got reverse beeps. the actual motor direction wasnt the main issue. so i would have had to hold the nunchuck upside down to have proper control. i am running one board per side(one left, one right) on my "skid-steer" so i had to get both motors (two per side) to respond correctly when in the same orientation on my vehicle. i will be controlling the boards with nunchucks independently of eachother, so that i am responsible for steering mix with my input. my current issue is that no matter how i set the filters, i am getting slight forward input to the board with nunchuck in resting state. is there some sort of way to set a deadband to mitigate the erroneous input while in resting state? or is this issue something that could be solved by an i2c pullup or pulldown?

On Thu, Feb 7, 2019 at 3:41 PM p-h-a-i-l notifications@github.com wrote:

ok, here is what you did :)

in main.c you reversed pwmr (could have done the same by removing #define INVERT_R_DIRECTION from config.h it would look like this:

//#define INVERT_R_DIRECTION

define INVERT_L_DIRECTION

(the other changes to your main.c do not really do anything :) )

your speed coefficient is negative in config.c so this is again changing the state of both INVERT_R_DIRECTION and INVERT_L_DIRECTION.

so your config would now be like:

[...] //#define CONTROL_ADC // use ADC as input. disable DEBUG_SERIAL_USART2! [...]

define CONTROL_NUNCHUCK // use nunchuck as input. disable DEBUG_SERIAL_USART3!

[...]

define FILTER 1.0 // lower value == softer filter. do not use values <0.01, you will get float precision issues.

define SPEED_COEFFICIENT 1.8 // higher value == stronger. 0.0 to ~2.0?

define STEER_COEFFICIENT 0.0 // higher value == stronger. if you do not want any steering, set it to 0.0; 0.0 to 1.0

define INVERT_R_DIRECTION

//#define INVERT_L_DIRECTION

define BEEPS_BACKWARD 1 // 0 or 1

[...]

with a clean repo you should get the same behaviour

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/NiklasFauth/hoverboard-firmware-hack/issues/76#issuecomment-461587527, or mute the thread https://github.com/notifications/unsubscribe-auth/Asx0c7qgoC_fdhbukmwHUg9cIAd_wcBVks5vLI9dgaJpZM4aYs8m .

p-h-a-i-l commented 5 years ago

backward beeping is based on "speed", which is only based on input. So it shouldn't beep. But anyways, you could also just disable backwards beeping.. FILTER only does smoothing of the speed and steer, it does not set an offset. You can either program a way to calibrate the nunchuck, or hard code an offset. Just replace 127 and 128 with values fitting for your nunchuk https://github.com/NiklasFauth/hoverboard-firmware-hack/blob/9beae76952119e3bb3e367d43a307f4ac420c6e4/Src/main.c#L188-L189

snowkingcro commented 5 years ago

My PPM decoder seems to be delayed in shipping because the Chinese New Year Holidays... :/ So i have no choice but to get my compiler working again. @benjaf i disabled UART3, but i got this message...any toughts? compile

benjaf commented 5 years ago

@snowkingcro That seems very strange. I tried disabling DEBUG_SERIAL_USART3, and the build still works just fine. I don't know much about Cygwin though, I've been using MinGW. Looks like it's not able to find/read some of the files?

p-h-a-i-l commented 5 years ago

I found it very easy to get a new system to compile when using platformio. It's usually three steps:

  1. install vscode
  2. add platformio extension
  3. clone git repository
snowkingcro commented 5 years ago

@p-h-a-i-l i have visual c instaled, but platformio seems not working for me... I don't have the ability to build (or compile)... I reinstaled, tried a few things, but i use it to edit the code. @benjaf, I'll try the miniGW, but for the missing files, i don't know why i get this... Would it help if i only copy config.h into the original repo? Or should i copy something else?

p-h-a-i-l commented 5 years ago

@snowkingcro The code needs some small modifications to compile in platformio (and a .ini file is necessary too) A working example can be found here https://github.com/p-h-a-i-l/hoverboard-firmware-hack/tree/pull

benjaf commented 5 years ago

@snowkingcro A clean repository often fixes that sort of problems. Try just commenting that one line in a new clone of the repo, and copy your own make file too - mine probably won't work for you.

Dan9287 commented 5 years ago

Hello again gents, ive created a simple facebook group to help keep some of the clutter out of the "issues" . please feel free to join, i am the sole admin (currently) but i will need some help for the real brains behind these projects.

"Hover-Hacks" https://www.facebook.com/groups/285402365465113/

Anyone willing to help, and share knowledge in the group will be greatly appreciated. The group is only 5min old so the page is pretty barren at the moment. Please share and invite also! Thank you!

On Fri, Feb 8, 2019, 12:58 PM Benjamin notifications@github.com wrote:

@snowkingcro https://github.com/snowkingcro A clean repository often fixes that sort of problems. Try just commenting that one line in a new clone of the repo, and copy your own make file too - mine probably won't work for you.

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/NiklasFauth/hoverboard-firmware-hack/issues/76#issuecomment-461890539, or mute the thread https://github.com/notifications/unsubscribe-auth/Asx0cxGtPxW_Ejs8ge9d3DHGN8xYT_B6ks5vLbrXgaJpZM4aYs8m .

snowkingcro commented 5 years ago

@benjaf i followed your advice, cleaned the repo, used original makefile, disabled UART3 finaly i managed to compile... but without success, nothing seems to work now... flashed again with your hex, so i got the speed again... 😊

Jana-Marie commented 5 years ago

@Dan9287 just that you know, we already do have a Telegram Group with ~60 members. @snowkingcro You've forked the Repo, can you push your changes, so we can see them. Maybe we will find the problem. :)

copterfight commented 5 years ago

@benjaf i followed your advice, cleaned the repo, used original makefile, disabled UART3 finaly i managed to compile... but without success, nothing seems to work now... flashed again with your hex, so i got the speed again...

i build @benjaf firmware, it working but with bug, https://youtu.be/4pRSbMTv8mA

snowkingcro commented 5 years ago

This is not a bug. I had the same problem, cut the wires shorter! This solved my problem.

Jana-Marie commented 5 years ago

Motor control (in general) can introduce quite some noise, you should suppress that by adding filters to the data lines. For example: ferrite bands or capacitors

BorgStefan commented 5 years ago

@snowkingcro A clean repository often fixes that sort of problems. Try just commenting that one line in a new clone of the repo, and copy your own make file too - mine probably won't work for you.

The PPM code is unlikely to work for you, if you have a standard 3 channel RC receiver. What is known as PPM in RC is generally only available on high-end 8 channel systems, mainly targeted at drones. It compresses all of the channels into a single 3-wire connector rather than having one connector per channel. This is what is supported by the firmware. What most common receivers use is known as PWM. The duration of the pulse varies between 1 and 2 milliseconds every ~20 milliseconds, and the timing doesn't really matter. Some changes will be required in order to get it to work! One channel should be relatively straightforward, I don't know about 2 or more. But maybe someone else have tried it?

@benjaf Thx Benjaf. I used your code to compile and flash my mainboard from a hoverboard. Then used a RC remote 2,4 Ghz 4 channels and it worked!! Thx for your code and if it would be possible I would show a video on it.

franck24300 commented 5 years ago

@benjaf Hello. I can not compile your program, even without modification. When I try I get this error:

franck@DESKTOP-TGVQI7F:/mnt/c/firmwaremodifie/hoverboard-firmware-hack-esk8-master$ make arm-none-eabi-gcc" -c -mcpu=cortex-m3 -mthumb -DUSE_HAL_DRIVER -DSTM32F103xE -IInc -IDrivers/STM32F1xx_HAL_Driver/Inc -IDrivers/STM32F1xx_HAL_Driver/Inc/Legacy -IDrivers/CMSIS/Device/ST/STM32F1xx/Include -IDrivers/CMSIS/Include -Og -Wall -fdata-sections -ffunction-sections -std=gnu11 -g -gdwarf-2 -MMD -MP -MF"build/stm32f1xx_hal_flash.d" -MT"build/stm32f1xx_hal_flash.d" -Wa,-a,-ad,-alms=build/stm32f1xx_hal_flash.lst Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_flash.c -o build/stm32f1xx_hal_flash.o /bin/sh: 1: Syntax error: Unterminated quoted string Makefile:139: recipe for target 'build/stm32f1xx_hal_flash.o' failed make: *** [build/stm32f1xx_hal_flash.o] Error 2 franck@DESKTOP-TGVQI7F:/mnt/c/firmwaremodifie/hoverboard-firmware-hack-esk8-master$

BorgStefan commented 5 years ago

Check in makefile that ”HOME = xxxx” Is defined correctly.

Br Stefan

9 juni 2019 kl. 23:28 skrev franck24300 notifications@github.com<mailto:notifications@github.com>:

@benjafhttps://github.com/benjaf Hello. I can not compile your program, even without modification. When I try I get this error:

franck@DESKTOP-TGVQI7F:/mnt/c/firmwaremodifie/hoverboard-firmware-hack-esk8-master$ make arm-none-eabi-gcc" -c -mcpu=cortex-m3 -mthumb -DUSE_HAL_DRIVER -DSTM32F103xE -IInc -IDrivers/STM32F1xx_HAL_Driver/Inc -IDrivers/STM32F1xx_HAL_Driver/Inc/Legacy -IDrivers/CMSIS/Device/ST/STM32F1xx/Include -IDrivers/CMSIS/Include -Og -Wall -fdata-sections -ffunction-sections -std=gnu11 -g -gdwarf-2 -MMD -MP -MF"build/stm32f1xx_hal_flash.d" -MT"build/stm32f1xx_hal_flash.d" -Wa,-a,-ad,-alms=build/stm32f1xx_hal_flash.lst Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_flash.c -o build/stm32f1xx_hal_flash.o /bin/sh: 1: Syntax error: Unterminated quoted string Makefile:139: recipe for target 'build/stm32f1xx_hal_flash.o' failed make: *** [build/stm32f1xx_hal_flash.o] Error 2 franck@DESKTOP-TGVQI7F:/mnt/c/firmwaremodifie/hoverboard-firmware-hack-esk8-master$

— You are receiving this because you commented. Reply to this email directly, view it on GitHubhttps://github.com/NiklasFauth/hoverboard-firmware-hack/issues/76?email_source=notifications&email_token=ALPFD3XMBEQUERVWV3TKR5DPZVYXVA5CNFSM4GTCZ4TKYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGODXISTVQ#issuecomment-500246998, or mute the threadhttps://github.com/notifications/unsubscribe-auth/ALPFD3TXRDR5KD4NWHP7P4DPZVYXVANCNFSM4GTCZ4TA.

franck24300 commented 5 years ago

@BorgStefan I can not find HOME = in the makefile I defined as in the makefile of Niklas, which I can compile if I do not modify anything : PREFIX = arm-none-eabi- To compile I use the method described here for Windows 10 : https://github.com/NiklasFauth/hoverboard-firmware-hack/wiki/Build-Instruction:-TranspOtter

BorgStefan commented 5 years ago

Hi,

I am a bit confused now. In your first mail, to my understanding you state you get the error message with no changes made to the code. Then now below you state the opposite?

I still believe there is a problem how "Home" is defined in the "Makefile"

I compile in my unix environment.

BR Stefan


Från: franck24300 notifications@github.com Skickat: den 10 juni 2019 11:07 Till: NiklasFauth/hoverboard-firmware-hack Kopia: BorgStefan; Mention Ämne: Re: [NiklasFauth/hoverboard-firmware-hack] PPM Optimized Firmware? - Request (#76)

@BorgStefanhttps://github.com/BorgStefan I defined as in the makefile of Niklas, which I can compile if I do not modify anything : PREFIX = arm-none-eabi- To compile I use the method described here for Windows 10 : https://github.com/NiklasFauth/hoverboard-firmware-hack/wiki/Build-Instruction:-TranspOtter

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHubhttps://github.com/NiklasFauth/hoverboard-firmware-hack/issues/76?email_source=notifications&email_token=ALPFD3Q4MMOZ3N4SZRNCWXDPZYKUPA5CNFSM4GTCZ4TKYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGODXJK6GA#issuecomment-500346648, or mute the threadhttps://github.com/notifications/unsubscribe-auth/ALPFD3UXPVP2OW5YYU5LFN3PZYKUPANCNFSM4GTCZ4TA.

franck24300 commented 5 years ago

Sorry for the confusion. If I try to compile the program without any modifications, I get the following error: $ make "C:/Program Files (x86)/GNU Tools Arm Embedded/7 2018-q2-update/bin/arm-none-eabi-gcc" -c -mcpu=cortex-m3 -mthumb -DUSE_HAL_DRIVER -DSTM32F103xE -IInc -IDrivers/STM32F1xx_HAL_Driver/Inc -IDrivers/STM32F1xx_HAL_Driver/Inc/Legacy -IDrivers/CMSIS/Device/ST/STM32F1xx/Include -IDrivers/CMSIS/Include -Og -Wall -fdata-sections -ffunction-sections -std=gnu11 -g -gdwarf-2 -MMD -MP -MF"build/stm32f1xx_hal_flash.d" -MT"build/stm32f1xx_hal_flash.d" -Wa,-a,-ad,-alms=build/stm32f1xx_hal_flash.lst Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_flash.c -o build/stm32f1xx_hal_flash.o /bin/sh: 1: C:/Program Files (x86)/GNU Tools Arm Embedded/7 2018-q2-update/bin/arm-none-eabi-gcc: not found Makefile:139: recipe for target 'build/stm32f1xx_hal_flash.o' failed make: *** [build/stm32f1xx_hal_flash.o] Error 127

If I change in the makefile PREFIX = arm-none-eabi- I get the error described previously. Sorry for my ignorance but I can not find HOME = in the makefile.

BorgStefan commented 5 years ago

Hi, No the Home is not there. I was wrong 🙂

I will check when I get home to my linux machine.

BR Stefan


Från: franck24300 notifications@github.com Skickat: den 10 juni 2019 12:11 Till: NiklasFauth/hoverboard-firmware-hack Kopia: BorgStefan; Mention Ämne: Re: [NiklasFauth/hoverboard-firmware-hack] PPM Optimized Firmware? - Request (#76)

Sorry for the confusion. If I try to compile the program without any modifications, I get the following error: $ make "C:/Program Files (x86)/GNU Tools Arm Embedded/7 2018-q2-update/bin/arm-none-eabi-gcc" -c -mcpu=cortex-m3 -mthumb -DUSE_HAL_DRIVER -DSTM32F103xE -IInc -IDrivers/STM32F1xx_HAL_Driver/Inc -IDrivers/STM32F1xx_HAL_Driver/Inc/Legacy -IDrivers/CMSIS/Device/ST/STM32F1xx/Include -IDrivers/CMSIS/Include -Og -Wall -fdata-sections -ffunction-sections -std=gnu11 -g -gdwarf-2 -MMD -MP -MF"build/stm32f1xx_hal_flash.d" -MT"build/stm32f1xx_hal_flash.d" -Wa,-a,-ad,-alms=build/stm32f1xx_hal_flash.lst Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_flash.c -o build/stm32f1xx_hal_flash.o /bin/sh: 1: C:/Program Files (x86)/GNU Tools Arm Embedded/7 2018-q2-update/bin/arm-none-eabi-gcc: not found Makefile:139: recipe for target 'build/stm32f1xx_hal_flash.o' failed make: *** [build/stm32f1xx_hal_flash.o] Error 127

If I change in the makefile PREFIX = arm-none-eabi- I get the error described previously. Sorry for my ignorance but I can not find HOME = in the makefile.

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHubhttps://github.com/NiklasFauth/hoverboard-firmware-hack/issues/76?email_source=notifications&email_token=ALPFD3VBHFECUDMIRQLSBI3PZYSEDA5CNFSM4GTCZ4TKYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGODXJPKSQ#issuecomment-500364618, or mute the threadhttps://github.com/notifications/unsubscribe-auth/ALPFD3WX5XGBRWIYWLYHRTDPZYSEDANCNFSM4GTCZ4TA.