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

AVR UART regarding RTS/CTS

I am using a nRF51 dongle as a BLE tranciever and using UART to communicate with an 8bit AVR. I used BLE_APP_UART peripheral example and mostly just changed the pins used for commuincation from the USB pins to some GPIO pins, and added the segger RTT. I am using a logic level converter to interface with the AVR which is running at 5 volts.

For reasons the dongle crashes if i send messages too fast, and I am thinking it might got something to do with that I disabled flow control on the dongle, since the AVR don't have it.

I have hooked up a com cable to listen on the UART line to verify that only the nRF is crashing and not the AVR as well. It crashes even if the cable is not connected as well, so it's not causing it.

The error I get when debugging is 3004, from main.c line 426 which is here:

    /**@snippet [Handling the data received over UART] */
    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++;
    
                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)
                    {
error trigger->       APP_ERROR_CHECK(err_code);
                    }

I'm not sure how to go about this, I sort of need to get these messages faster than once per second so i'd appreciate some clues on to how to proceed

Parents
  • The issue is not with the UART, but with the BLE link. You are sending too many packets and the ble_nus_string_send(..) function is returning BLE_ERROR_NO_TX_PACKETS (error code 0x3004, previously called BLE_ERROR_NO_TX_BUFFERS). The error code originally comes from the sd_ble_gatts_hvx(..) function which is called inside ble_nus_string_send(..).

    See for example this post on how to handle this error code and send large amount of data. You should also make sure that the UART buffer (defined in APP_UART_FIFO_INIT) is large enough to buffer the data that are to be sent over BLE.

  • Are you refering to flow control on the BLE link(nRF51 to nRF51) or the UART link (nRF51 to AVR)?

    I am using another nRF51 dongle as central, perhaps I can adjust some settings on this to achieve higher throughput? My central is running an edited version of Marco Russis' BLE multilink NUS Central: github.com/.../nrf51_multi_nus_central

    My 270 bytes per second from the 54 character string every 200 millis from the peripheral to central seems a long way from the 5 300 bps - 128 000 bps mentioned in the thread you linked to, or am I mission something fundamental about this? How small is a small package?

Reply
  • Are you refering to flow control on the BLE link(nRF51 to nRF51) or the UART link (nRF51 to AVR)?

    I am using another nRF51 dongle as central, perhaps I can adjust some settings on this to achieve higher throughput? My central is running an edited version of Marco Russis' BLE multilink NUS Central: github.com/.../nrf51_multi_nus_central

    My 270 bytes per second from the 54 character string every 200 millis from the peripheral to central seems a long way from the 5 300 bps - 128 000 bps mentioned in the thread you linked to, or am I mission something fundamental about this? How small is a small package?

Children
No Data
Related