This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

CC3220SF: UART Receive using Callback mode

Part Number: CC3220SF


Hi,

I'm trying to receive data from uart in callback mode, but not able to achieve.

The incoming data is not of fixed length. so I can't set the amount of data to be received in UART_read() function so that it calls callback function when the buffer is full.

I need to copy the received data to a buffer and pass it to another function for processing.

Please help me on achieving this. If anybody has done this, kindly share the code snippets, it will be very helpful.

Thanks

BP

  • Hi BP,

    If the data you receive over UART is not of fixed length, then you have two main options. 

    The first and safest is to add a header before each packet of data where you describe how much data is to be transferred. There will be a few bytes of overhead, but this way you can setup a second UART_read() right after getting the size and capture all of the data that is sent.

    The second option is to use a timeout. In blocking mode, you can set the timeout directly in the UART_open() call. In callback mode, you can use a timer in your application that calls UART_readCancel(). With the readCancel() command, the callback is invoked with whatever data had already been read.

    Let me know if you need more clarification or have further questions on using the UART driver of the CC32xx.

    Regards,

    Michael

  • Hi Michael,

    Thanks for your response.

    I would like to go with the second option...

    Can you please provide me more information on how to implement this method (both Blocking and Non-Blocking)........?

    Do you have any sample code.......?

    Thanks,

    BP

  • Hi BP,

    The documentation for the TI Drivers can be found in the "docs/tidrivers" folder of the SDK or online here:

    http://dev.ti.com/tirex/explore/node?node=AIQLpsWAlAhNbRw7tZeAww__fc2e6sr__LATEST

    Click on the "Drivers and Documentation" section and then "UART.h".

    Best Regards,

    Ben M