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.

TMS320F280025: Question about uint16_t

Part Number: TMS320F280025
Other Parts Discussed in Thread: C2000WARE

Dear team:

C:\ti\c2000\C2000Ware_4_00_00_00\driverlib\f28002x\examples\can

void CAN_sendMessage(uint32_t base, uint32_t objID, uint16_t msgLen, const uint16_t *msgData)

The data in the above code is in uint16_t format, is its data width 16bit? Or only the lower 8 bits are valid?

Because the customer sees in the 280025 manual that one byte of data in the CAN data register is 8bit instead of 16bit.

In addition, the customer sees that the data in the CAN protocol data frame is 0 - 8 bytes, and one byte is 8 bits, that is, 0 - 64 bits.

Now the client sends 8 bytes of data to 280025,

bool CAN_readMessage(uint32_t base, uint32_t objID, uint16_t*msgData)

Will this receiving function convert 8 8bit data into 4 16bit data, or will it still read 8 uint16_t data, and then the lower 8bit data is valid?

Best regards

  • Green,

           I will work with the software team for the answer, since they are responsible for the Driverlib functions. Please give me a few days. 

  • Hi Hareesh:

    Wait for your reply.

    Best regards

  • Green,

       I apologize for the delay. Sahil from the s/w team said he'd respond shortly. In the interim, allow me to offer some insights:

    The smallest quantum of data the CAN protocol supports is indeed a byte (which, by definition is 8-bits). In a frame you can transmit 0 to 8 bytes.

    I checked with my can_ex4_simple_transmit.c, which has the follwing declaration: uint16_t txMsgData[8];

    When I look at the Expressions window, I see this:

    So, "still read 8 uint16_t data, and then the lower 8bit data is valid" appears to be true. We will await confirmation from Sahil.

    I consulted a s/w expert in Houston, who mentioned that we use uint16_t since we don’t have a true 8-bit data type. 

  • Green, 

    I apologise for the late reply.

    First of all, C28x is a 16 bit addressable device, which means one address holds 16 bits, hence, the smallest data-type we have is uint16_t.

    While the smallest data width that can be transferred over CAN is 8 bits, so the functions were developed such that the lower 8 bits of uint16_t are transmitted or received at a time.

    Will this receiving function convert 8 8bit data into 4 16bit data, or will it still read 8 uint16_t data, and then the lower 8bit data is valid?

    Based on the explanation above, it is the latter (8 uint16_t data read but only lower 8 bit data valid).

    Thanks, Sahil.