rananna wrote: ↑Dec 28 2020 12:55pm
I do not understand.
What exactly is the issue you are seeing when burning the board?
When the issue did happen, I could not program anymore the board. I also verified there was no more 3.3V on the board. After removing the components of the DC-DC converter and put 3.1 volts on the 3.3V line, I could not program again, so, I think the board is dead.
For the turn on / off, I have this code on the Bluetooth handler. The value must be different of 255, otherwise is ignored, like you should send only one time the assist level and other times as value 255. The same for turn on / off the motor.
Code: Select all
static void tsdz2_write_handler_periodic(uint8_t *p_data, uint16_t len)
{
if (p_data[0] != 255)
ui_vars.ui8_assist_level = p_data[0];
if (p_data[1] != 255)
{
switch (p_data[1]) {
case 1:
// turn on TSDZ2 motor controller
if (m_TSDZ2_power_state == TSDZ2_POWER_STATE_OFF)
m_TSDZ2_power_state = TSDZ2_POWER_STATE_ON_START;
break;
case 2:
// turn off TSDZ2 motor controller
if (m_TSDZ2_power_state == TSDZ2_POWER_STATE_ON)
m_TSDZ2_power_state = TSDZ2_POWER_STATE_OFF_START;
break;
}
}
}
The status of TSDZ2 motor init state are a few states and so is a complete byte, because some states can give feedback if the process blocked like wrong firmware version:
This is sent periodically every 50ms by Bluetooth: tx_data[32] = (uint8_t) g_motor_init_state; It will be MOTOR_INIT_READY when motor is ready and MOTOR_INIT_GET_MOTOR_ALIVE, when motor is disabled.
Note that to get up to MOTOR_INIT_READY, will take at least 6 seconds!!
Fatal errors:
- MOTOR_INIT_ERROR_GET_FIRMWARE_VERSION
- MOTOR_INIT_ERROR_FIRMWARE_VERSION
- MOTOR_INIT_ERROR_SET_CONFIGURATIONS
Code: Select all
volatile motor_init_state_t g_motor_init_state = MOTOR_INIT_GET_MOTOR_ALIVE;
typedef enum {
MOTOR_INIT_GET_MOTOR_ALIVE = 0,
MOTOR_INIT_READY = 1,
MOTOR_INIT_WAIT_MOTOR_ALIVE = 2,
MOTOR_INIT_GET_MOTOR_FIRMWARE_VERSION = 3,
MOTOR_INIT_WAIT_MOTOR_FIRMWARE_VERSION = 4,
MOTOR_INIT_GOT_MOTOR_FIRMWARE_VERSION = 5,
MOTOR_INIT_ERROR_GET_FIRMWARE_VERSION = 6,
MOTOR_INIT_RECEIVED_MOTOR_FIRMWARE_VERSION = 7,
MOTOR_INIT_ERROR_FIRMWARE_VERSION = 8,
MOTOR_INIT_SET_CONFIGURATIONS = 9,
MOTOR_INIT_WAIT_CONFIGURATIONS_OK = 10,
MOTOR_INIT_WAIT_GOT_CONFIGURATIONS_OK = 11,
MOTOR_INIT_ERROR_SET_CONFIGURATIONS = 12,
} motor_init_state_t;