stancecoke / BMSBattery_S_controllers_firmware

OSEC Open Source E-Bike Controller in a Windows toolchain for a STM8
https://github.com/stancecoke/BMSBattery_S_controllers_firmware/wiki
134 stars 59 forks source link

Help with debugging KT36/48ZWSR-SX02 #33

Open Avtopolet opened 6 months ago

Avtopolet commented 6 months ago

Hello. Im trying to launch firmware on KT36/48ZWSR-SX02 (board KT-6S5-C, six FETs). Firmware compiling and flashing without errors. Im compare programmed chip and main.hex in STVP -ok Firmware compiled as diagnostics without LCD. Consumption of controller - approx 30 mA. Serial port connected as in instructions and nothing outgoing. Debug pin (PD2) always LOW (in first lines of main, after debug pin init im set it to HI). Trying to use stm8-debug for VS Code, but it need elf file. Im add this to make file : ... ELF_FLAGS = --out-fmt-elf --debug ... $(PNAME): $(MAINSRC) $(RELS) $(CC) $(INCLUDES) $(CFLAGS) $(ELF_FLAGS) $(LIBS) $(MAINSRC) $(RELS) $(SIZE) $(PNAME).elf -A $(OBJCOPY) -O binary $(ELF_SECTIONS_TO_REMOVE) $(PNAME).elf $(PNAME).bin $(OBJCOPY) -O ihex $(ELF_SECTIONS_TO_REMOVE) $(PNAME).elf $(PNAME).hex Its leads to error: ACAcommons.asm:2829: Error: relocation error make: *** [ACAcommons.rel] Error 1 Need help :)

Avtopolet commented 6 months ago

Part of the problem was solved by reassignment debug pin to PG1. Controller starts, wheel turning and im can see telemetry by UART. But question about debugging still actual. I'm try to use controller for my purpose (not ebike), and im want to control it by UART. When i'm send more then 11 bytes (readRtu) - controller catch array overflow exception in uart_fill_rx_packet_buffer. How to avoid it?