2018-11-22 07:51 AM
Hello All,
I have an STM32L486 and use the SPI3 to connect a SPI flash device.
The code uses CubeMX L4 1.13 HAL SPI and seems to work.
But after reflash or reboot the SPI returns only 00h values.
After an power on reboot it looks all fine.
I compared in that cases the CR1,CR2,SR registers also AF assignment. And all those look fine.
I saw some items in the forum but do not know if that is related to my case.
Ususally I work with STM32F437 that has SPI with no FIFO.
The L468 device has FIFO.
Any pointers where to look?
regards. Adib.
--
2018-11-22 08:00 AM
External SPI Flash devices frequently lack an async reset pin, therefore can come up in an indeterminate state, especially if you don't have pull-ups to hold states of things like CS, and CLK pins.
Your startup code should try to read the chip id registers, and be able to retry. Check if any reset methods are described in the part's data sheet.
Suggest you use a scope or analyzer to see what's actually happening at the pins, and how the Flash device is responding.
Avoid placing a debug view over the SPI Peripheral registers, and instead add code to print diagnostic/telemetry about what it sees and what is happening from within the code.
2018-11-22 08:28 AM
Hello Clive, Thanks for fast response.
Actually I do try to read the ChipID. Although I do not repeat.
I always send a dummy byte before communicate to let the SPI settle clock polarity.
I print the register values using SEGGER RTT using JLINK before and after the HAL functions.
I connected wires to the pins to check with saleae and will report tomorrow.
Regards, Adib.
--
2018-11-23 03:43 AM
I confirm that the FLASH works so far.
But the MISO line is somehow driven low.
As I use SPI3 on PC10/11/12 I checked the AF values on GPIOC and they are on 666 for those. That is correct. Mode is on 222, also correct.
I tried to change the GPIO to Input but that low drive remains.
(I do have resistors in between CPU and flash)
I checked the chip-errata but there is nothing related GPIOC or SPI.
Any idea?
Regards, Adib.
2018-11-23 06:05 AM
And always if you think you found a hardware problem, it is a software problem ;)
I use wrong commands on that flash and that cause the chip to malfunction ....
Adib.