I need to be a SPI master and send words greater than 16 bits. If I were to write my own driver, I see the PUSHR with Tx FIFO register looks promising. However, I would rather use CodeWarrior's ProcessorExpert (Component Inspector) to create a suitable SPI device drivers. I am wondering if someone has come across this - and if there is a SPI "bean" created that has a SPI driver that supports longer words (I need 24 bit).
I can create a SPI init bean that may be helpful (havent tested it yet) - and of course a regular SPI Master LDD bean. Is there a way for init_SPI and SPIMaster_LDD to play together? (component sharing somehow?) Or am I relegated to cut/pasting/editing my own driver.
已解决! 转到解答。
Vojtech,
Actually - it is OK - I didnt realize that using the CONT bit in the PUSHR register (as the auto-gen'd code does) would work for me. After looking at the auto-gen'ed code more closely I was hopeful it would just work - I just give the DAC_SPI_PTD_SendBlock API a size argument longer than 1 and using the CONT bit, the CS stay asserted through multiple "character" writes. so if I want my 24 bit word, I just set up the data width for 8bits, and send three bytes. Sorry for the trouble,
Hello,
could you please provide more details about your use-case including targeting MCU and details regarding slave device? However generally you cannot share/use Init_SPI and SPIMaster_LDD component together.
Based on your description, there are the following options:
- use Init_SPI and write the run-time routines manually.
- use SPIMaster_LDD, freeze the generated code and modify it manually.
- use the SPIMaster_LDD and set it to send 8-bit data (handle the SS by GPIO_LDD in case you need to toggle after 24-bits).
Note:
Please post all future PEx related questions on PEx forum: Processor Expert Software
best regards
Vojtech Filip
Processor Expert Support Team
Vojtech,
Actually - it is OK - I didnt realize that using the CONT bit in the PUSHR register (as the auto-gen'd code does) would work for me. After looking at the auto-gen'ed code more closely I was hopeful it would just work - I just give the DAC_SPI_PTD_SendBlock API a size argument longer than 1 and using the CONT bit, the CS stay asserted through multiple "character" writes. so if I want my 24 bit word, I just set up the data width for 8bits, and send three bytes. Sorry for the trouble,