CC2340R5: Debugging UART Baud Rate Compatibility Issue in CC2340R5 Central-Peripheral Data Stream Communication

Part Number: CC2340R5

Tool/software:

I have modified the Data Stream Project to enable Peripheral + Central roles and flashed it onto a CC2340R5 device. Another CC2340R5 device is running the unmodified Data Stream Project in the Peripheral role. Both devices establish a BLE connection successfully.

  • UART Communication at 115200 Baud Rate: Data transmission and reception between the devices via UART (central-to-peripheral) work flawlessly.
  • UART Communication at 9600 Baud Rate: After a few seconds of continuous data transmission and reception, the central device hangs.

The end device attached to the BLE module supports only a 9600 baud rate, making it essential for the communication to work seamlessly at this baud rate.

Central Device Setup and Code:

I have attached screenshots showing:

  1. The setup for the Central Device.
  2. The code handling data read/write operations for the Data Stream Service's characteristics.

Urgent Support Needed:

  1. Potential Issue: It appears the central device's UART interface or buffer handling may not handle slower baud rates (9600) effectively during high-frequency data transmission.
  2. Request for Suggestions: Please suggest modifications to the code, UART configurations, or flow control mechanisms to resolve this issue.
    Fullscreen
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    // Writing UART data to the peripheral from central device
    void sendUartToDataIn() {
    bStatus_t status = SUCCESS;
    uint16_t offset = 0;
    uint16_t mtuSize = 200;
    uint16_t headerSize = 3; // Approximate GATT header size
    uint16_t maxChunkSize = mtuSize - headerSize;
    uint16_t dataLength = BufferSize;//strlen((char*)uartReadBuffer); // Total data length
    attWriteReq_t req;
    char buffer[40];
    // Loop until all data is sent
    while (offset < dataLength) {
    // Determine the chunk size for this iteration
    uint16_t chunkSize = (dataLength - offset > maxChunkSize) ? maxChunkSize : (dataLength - offset);
    bool chunkSent = false;
    // Retry sending the current chunk until successful
    while (!chunkSent) {
    // Allocate memory for the write request
    req.pValue = GATT_bm_alloc(0x0, ATT_WRITE_REQ, chunkSize, NULL);
    XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

Thanks for your support.

  • Hello Aman,

    Thanks for reaching out. Please help me with the following to better understand the issue:

    1. What SDK version are you using?
    2. What device is crashing/hanging, unmodified Data Stream running as peripheral or modified DS running as central + peripheral?
    3. Does the device hangs as well when you are running the code in debug mode? Could you share where is the code hanging? A screenshot of the paused debug session when the device hangs can be a helpful to share.
    4. How is the UART driver configured (parameters)?

    BR,

    David.

  • Here is the following details - 

    1. simplelink_lowpower_f3_sdk_8_40_00_61
    2. Modified DS running as a central+peripheral

    3. I haven't check it in debug mode. Please suggest if any modification required at uart level or data handling. 


  • Hello Aman,

    I would suggest to go into debug mode and see where the program is crashing so we can get more information about what might be happening. From what you have shared, I don't see yet what could be going on. However, you mentioned you need 9600 baudrate, is this required to transmit data to the PC or to another host device? Could you please show me where you are modifying the baudrate?

    BR,

    David.