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.

Receiving 32 bit data SCI UART

Other Parts Discussed in Thread: HALCOGEN

UART can transmits or receives 8 bit data.

I know how to transmit 32 bit data because I act as the transmitter and I can program the transmitter to send 4 sets of 8 bits data that represents the 32 bit integer. But since the device I use acts as the receiver, I'm wondering if I can use SCI UART to receive 32-bit data.

How can I receive 32 bit data using UART without programming the transmitter? 

  • David, Maximum data size the SCI can handle is 8 bits at a time. U"A"RT does "asynchronous" rx and tx. So your receiver side can receive 4 sets of 8 bit data and assemble a 32 bit value, just as you described . The TX side of one UART does not need to be transmitting to receive data from another UART. Thanks, Joe
  • Hello David,

    As Joe had mentioned, there is no need to worry about the transmit part if you are just only receiving.

    Keep looking for RX status flags and once new data is in you can always read and store it then look for the next one.

    Pls have a look at sciReceive() function in halcogen where you can give the length of data expected and the buffer pointer so it automatically returns the expected data of the receive is complete.

    There are multiple other ways to do this using interrupts as well if needed, with the above being simplest.
  • Just curious, if I use sciReceive() function with length parameter set on 4, will the 32 bit data need to be stored in an array of character (Do I need to set an array of 4 characters as the last parameter of the function void sciReceive(sciBASE_t *sci, uint32 length, uint8 * data) ).
  • That function accepts a pointer and it increments by 8-bits after storing every data.So keeping the pointer as base if you have the length set to 4 it will eventually populate 32-bits of new data. You can always type cast and use it the way you want.

    Instead you can use SciReceiveByte() and then manually shift and append if you are comfortable this way as well.