Dave 4 - SPI_MASTER_Transmit with 8Bit data

Tip / Sign in to post questions, reply, level up, and achieve exciting badges. Know more

cross mob
Not applicable
Hi,
At the moment, I need the SPI_MASTER_Transmit function of the dave 4 SPI_MASTER app to work with 8 Bit data. I tried to send three times data like 0xaa with 8 bit length in sequence and checked the oscilloscope. But with the standard 16 bit dataptr and the following uint16_t tx_data in spi_master.h it simply didn't show the transmission I expected.
So, I changed

  • the dataptr parameter in SPI_MASTER_Transmit function
  • tx_data in spi_master.h
  • and the other uint16_t cast in SPI_MASTER_lTransmitHandler

to uint8_t. I think there were still some changes in xmc_spi.c, like ffffU to ffU or something. Iwas glad it worked and the transmission shown by oscilloscope was right.

But my aim is to outsource the transmit function in a new c and header file, so that it won't overwrite my changings each time I generate new code or change the SPI settings in the app.

My first try, to simply create a new function SPI_MASTER_Transmit2, turned out as impossible. SPI_MASTER_Transmit2 needs a dynamic_handle of the kind SPI_MASTER_DYNAMIC_CONFIG_t, so I to crated SPI_MASTER_DYNAMIC_CONFIG2_t to ensure a uint8_t tx_data. But then the typedef struct SPI_MASTER didn't contain SPI_MASTER_DYNAMIC_CONFIG2_t and I had to copy this again.This continued and after copy/pasting and renaming the SPI_MASTER02 in the header file compiler said: SPI_MASTER_0_Config undeclared function to the & marked adresses in the lines with .config and .dynamic_config.
So I came to the point where I had to copy the generated code structures from spi_master_config.c in my outsourced files to make it work. But by doing this, the code is not adjustable by app anymore...

I really can't find a solution to write a 8 bit transmit function. All functions and structures are extremely linked together.

I hope someone can help me. Best regards!
0 Likes
1 Reply
Not applicable
Hi,

SPI_MASTER APP enables 64bit Frame Length by default. Have you tried to change it?

BR,
Zain
0 Likes