cancel
Showing results for 
Search instead for 
Did you mean: 

Hello! Is there some settings either in CubeMX or Atollic that I should do to be able to use several SPIs? Thanks!

fate
Associate

I'm using the STM32H743ZI with STM32CubeMX and Autollic. with external ADC and DAC with SPI. I have 4 ADC, different CSs, connected to the SPI1 and 1 DAC to SPI2. My DAC works but I get zeros from ADCs. I tested to connected another ADC to SPI3 and disabled SPI1. I saw that when I only used the SPI3, it worked but when I enabled SPI2 (my DAC), SPI3 stopped working. I send some values to my DAC once and read the ADC inside the While(1) loop. 

SPI1- mood (Recieve only Master) connected to ADCs

SPI2- mood( transmit only Master) connected to DAC.

I have already checked the spi settings for both ADC and DAC in separate test-board

1 ACCEPTED SOLUTION

Accepted Solutions
fate
Associate

thank you so much for the feekbacks!

Ok my problem was easily solved by settig all CS to high (inactive) in the beggining (it seems that some where low(active) as default. The daisy chained was a good idea that I didn't think about. Thanks!

View solution in original post

3 REPLIES 3

You'd need multiple instances of the SPI structures, and move to a model which allows for parallel/concurrent use rather than sequential and blocking API calls. Putting all your interaction in a singular loop looks like the latter.

Tips, buy me a coffee, or three.. PayPal Venmo Up vote any posts that you find helpful, it shows what's working..
S.Ma
Principal

Well if you use 2 SPI it is probably to have then run at least one in parallel.

don't know the 3rd generation SPI IP on the H7, however would reccomend to still program it as if it was a regular 4 wire SPI and just no activate the pin you don't need (MOSI or MISO).

In the past, use interrupt + DMA ISR state machine to concurrently drive in // 3 SPI Slave devices.

Have you checked DMA channels, GPIOs, Alternates, ISRs are all there?

And by any chance, if your ADC can be daisy chained, it could reduce the NSS numbers down to one which is SW handled.

fate
Associate

thank you so much for the feekbacks!

Ok my problem was easily solved by settig all CS to high (inactive) in the beggining (it seems that some where low(active) as default. The daisy chained was a good idea that I didn't think about. Thanks!