Hi!
I am trying to flash a component on my custom embedded PCB that embarks a NRF52832 through BLE. To do this, I run on my PC a python script that reads from a hex file (too big to be stored on the device) and sends it through BLE to the NRF so the data can be flashed through I2C.
Although a strange behaviour is observed:
The python script sends the following array :
[0x01, 0x80, 0x02, 0x1D]
static void on_write(ble_ppg_debug_t *p_ppg_debug, ble_gatts_evt_write_t write)
{
switch (write.uuid.uuid)
{
case PPG_DEBUG_UPDATE_GET_DATA:
NRF_LOG_INFO("RCV GET UPDATE_DATA val = %d \r\n", write.data[0]);
NRF_LOG_FLUSH();
uint32_t cmd_delay = 0;
bool end_of_page_reached = (bool)write.data[0];
uint8_t payload_size = (write.len - 1);
NRF_LOG_INFO("%02x %02x %02x %02x %02x %02x", write.data[0], write.data[1], write.data[2], write.data[3], write.data[4], write.data[5]);
NRF_LOG_FLUSH();
break;
}[0x01, 0x80, 0x02, 0x1D, 0x00, 0x00]Which is correct
switch (write.uuid.uuid)
{
case PPG_DEBUG_UPDATE_GET_DATA:
NRF_LOG_INFO("RCV GET UPDATE_DATA val = %d \r\n", write.data[0]);
NRF_LOG_FLUSH();
uint32_t cmd_delay = 0;
bool end_of_page_reached = (bool)write.data[0];
uint8_t payload_size = (write.len - 1);
uint8_t rx_buffer[243];
for (uint8_t i = 0; i < payload_size; i++)
{
rx_buffer[i] = write.data[i + 1];
}
NRF_LOG_INFO("%02x %02x %02x %02x %02x %02x", rx_buffer[0], rx_buffer[1], rx_buffer[2], rx_buffer[3], rx_buffer[4], rx_buffer[5]);
NRF_LOG_FLUSH();
break;
}[0x80, 0x00, 0x00, 0x80, 0x00, 0x00]
- NRF52832
- Ubuntu 20.04
- Python3 with Bleak library
- RTT logs