Skip to content
stancecoke edited this page Sep 10, 2020 · 4 revisions

to activate the debug mode, set #define DISPLAY_TYPE DISPLAY_TYPE_DEBUG in the config.h

Connect GND, Tx and Rx of an USB-UART converter or a HC05-Bluetooth-module to the display connector and short red to blue to switch on the BMT.
I recommend HTERM at 115200 Baud and newline @ CR-LF to watch and log the debug information on a windows laptop. For mobile use with bluetooth, I recommend Blueterm on Android.

There are three different working modes in Debug mode. You can switch the mode by sending four bytes from the terminal to the BMT. Make sure, that you always send a block of exactly four bytes. The motor runs only in the 00 mode.

If you send
hex 00 00 00 00 once to the BMT, the BMT will send variuos prepared values (the sent parameters may change with the commits):
sprintf(UART_TX_Buffer, " %d, %ld, %d, %d, %d, %d, %d, %d, %d, %d, %d \r\n", i8_Throttle, i32_Gauge_Torque_cumulated, MS.Power, MS.Speed, (int16_t)(ch_GaugeVoltage_Hi<<8)|ch_GaugeVoltage_Lo, i16_Gauge_Torque, i16_Current_Target ,adcData[0], adcData[1], adcData[2], adcData[3]);

To read out recent BionX-Register values you have to send
hex 02 xx 00 00, where xx is the register adress, you want to read

To write recent BionX-Register values you have to send
hex 01 AA 00 A5 to remove the write protection

then
hex 01 xx hb lb, where xx is the register address, you want to write to, hb the hi-byte and lb the lo-byte of the value you want to set.

In mode 01 and 02 the BMT sends the received CAN messages to UART: sprintf(UART_TX_Buffer, "%d, %d, %d, %d, %d, %d, %d\r\n", (int16_t) RxHeader.StdId, (int16_t) RxHeader.IDE, (int16_t) RxHeader.DLC, RxData[0],RxData[1],RxData[2],RxData[3]);

For the different available BionX-Register addresses, see the file CAN-registers.h

Clone this wiki locally