cancel
Showing results for 
Search instead for 
Did you mean: 

STM32L4R9 Octo SPI test

maya123
Associate II
I want to use L4R9's OSPI interface.
I only have a microcontroller board, and I want to test whether it can send data.
During the test, I found that the HAL_OSPI_Transmit() function never sends data,
and the oscilloscope cannot pick up the waveform.
It is speculated that the reason is that the NCS film selection cannot be lowered.
My board is in the OSPI_READY state after powering on, and even though I added the write enable function,
there is no way to realize data transmission. Even if the chip select line is forcibly set to GPIO type and manually pulled low in the program,
the HAL_OSPI_Transmit() function still cannot work. My cube configuration and test program are as follows:maya123_0-1730275514056.png

maya123_1-1730275518839.png

HELP ME,PLEASE!!!

In addition to the failure of the microcontroller, are there any other unreasonable configurations that may cause data transmission to fail?

5 REPLIES 5
Imen.D
ST Employee

Hello @maya123,

Try the read-to-use OSPI example available on the STM32CubeL4 MCU package within 32L4R9IDISCOVERY:

STM32CubeL4/Projects/32L4R9IDISCOVERY/Examples/OSPI at master · STMicroelectronics/STM32CubeL4 · GitHub

So, compare the provided code there with your code to figure out what is missed there.

Have a look at these resources that may help you with tips and the link to the videos:

When your question is answered, please close this topic by clicking "Accept as Solution".
Thanks
Imen

More probable that you don't initialize the interface properly or construct a command structure for the peripheral.

You present NO code.

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

Initialize and interact with it like it's a MEMORY DEVICE

Don't assume you can blindly Transmit to it.

The Peripheral might have more capabilities, but the HAL is going to want more normative behaviour.

Look at code examples which illustrate normal command, address, data phase interactions.

The peripheral manages the NCS if you've initializes the thing properly, and interact with in normally.

See QSPI/OSPI examples within the CubeL4 libraries and BSP code

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..
Sorry  my mistake. 
I forgot to post the code.
Since other interfaces on the board (USART, I2C, etc.) are occupied,
at this stage I can only judge the status of the team through the flashing of the LED light.
Here is a screenshot of my code:

maya123_0-1730335983656.png

There is an initialization part in the code, 
and the light does not flash after powering on.
I think it means it is in the OSPI_STATE_READY state.
Regarding the instruction structure, I will try again.
Thanks! 

 

Imen.D
ST Employee

Hi @maya123 ,

The Chip select pin is not configured, that's why "NCS film selection cannot be lowered."

ImenD_0-1730816932313.png

So, try to enable chip select pin.

ImenD_1-1730816937124.png

 

 

When your question is answered, please close this topic by clicking "Accept as Solution".
Thanks
Imen