This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

Nrf51822 and STM32 uart bootloader problem

Hello

I try to use this bootloader https://github.com/williamhuang03/STM32F4-Custom-Bootloader on STM32F4 which works well through cable but as suddenly I use Nfr51 as transmitter and ESP32 as receiver so it doesn't work problem is that STM32 bootloader sends these commands in hex format #define ACK 0x06U, #define NACK 0x16U which Nrf51 uart rx ignores. Can mini advise where can be the problem ? I use the standard ble_app_uart code that is included with SDK_8.0.0 thank you for your advice.

Parents Reply
  • Looking at the ble_app_uart code in SDK v8.0.0 you should be able to alter it to send a byte as soon as it is received over UART instead of waiting for the '\n' character. See comment below

    void uart_event_handle(app_uart_evt_t * p_event)
    {
        static uint8_t data_array[BLE_NUS_MAX_DATA_LEN];
        static uint8_t index = 0;
        uint32_t err_code;
    
        switch (p_event->evt_type)
        {
            case APP_UART_DATA_READY:
                UNUSED_VARIABLE(app_uart_get(&data_array[index]));
                index++;
                
                //Remove if statement and send a single byte each time the APP_UART_DATA_READY event is processed.
                if ((data_array[index - 1] == '\n') || (index >= (BLE_NUS_MAX_DATA_LEN))) 
                {
                    err_code = ble_nus_string_send(&m_nus, data_array, index);
                    if (err_code != NRF_ERROR_INVALID_STATE)
                    {
                        APP_ERROR_CHECK(err_code);
                    }
                    
                    index = 0;
                }
                break;
    
            case APP_UART_COMMUNICATION_ERROR:
                APP_ERROR_HANDLER(p_event->data.error_communication);
                break;
    
            case APP_UART_FIFO_ERROR:
                APP_ERROR_HANDLER(p_event->data.error_code);
                break;
    
            default:
                break;
                }
    }

Children
Related