SPI with STM32f429
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2018-09-03 8:39 AM
Hi,
I am using an STM32f429 Discovery board with CubeMX and HAL, and have some problems regarding SPI. I am using an DAC which takes data in 24 bit format, 8 control bits and 16 data.
- I can only select between 8 or 16 bit data, not both. If I try to send 8 bit control data in 16 bit mode I get extra clocks either end depending if LSB or MSB is sent first. I have tried changing between modes via the hspi struct but it won't change after first configuration.
- I am using 3 element 8 bit 2D arrays for to store initial control data & output state data but the order of SPI data transmitted via HAL_SPI_Transmit_DMA(&hspi1,Var,3)
when declared as Var[]={1,2,3} is actually {1 3 2} where 3 is transmitted as 85.
- The last element of the array (except the 2nd since order is messed up) is always transmitted as 85 (01010101) regardless of what I set it to.
Please can someone advise?
Thanks
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2018-09-07 3:32 PM
if you look carefully at the nSS pin in the datasheet of the DAC you will see is not 8 or 16 bit aligned, but message aligned.
I am not sure HAL can work with that.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2018-09-10 8:48 AM
I've managed to fix the last two problems. My only issue now is how to switch between 8 and 16 bit mode on the fly? Could someone please advise?
I'm not sure what you mean about nSS pin won't work - afaik hardware nSS in HAL isn't working anyway - is this what you meant? So I was going to soft toggle it myself.

- « Previous
-
- 1
- 2
- Next »