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.

HALCoGen SPISend 8 bits

Other Parts Discussed in Thread: HALCOGEN

I'm looking for the best way to transmit bytes with the HALCoGen SPI api.

The srcbuff parameter takes a uint16 *

I can set in HALCoGen that the SPI data format length is 8 bits.

Does this send each uint16 as two times a byte, or does this ignore 8 most significant bits of the uint16?

If I want to send 4 byte  values, should I create

  • - a buffer uint16 TX_Data_Master[2]  and expect that the API take care that it send this as 4 bytes, or
  • - a buffer uint16 TX_Data_Master[4] and take care that the values don't hold anything bigger than a byte?

Confused :)

  • Hello Jan,

    I have forwarded your question to our Halcogen team lead. They should reply to your question soon.

  • I've done some further analysis. By looking at the code in spi.c/h and monitoring behavior in an SPI capable logic analyze (I adapted TI's example SPI_Transmit_Interrupts to try and send the value 0x0F01 in 8 and 16 bit format and the 0F part did not arrive in the 8 bit config) , I would say:

    • you define the data format in HALCoGen as 8 bit
    • you have to define an array of uint16_t and pass that to the spi APIs
    • you should only assign 0xFF or less to the array values, because the spi APIs will only send that part. Anything held in the most significant byte is dropped when setting SPI format's bit size to 8.