Failure of CMD0 sending using STM32F769 + SPI2 for [samples/subsys/fs/fat_fs] #spi #fatfs


@yasokada
 

My environment:
Ubuntu 18.04 LTS
STM32L476 Nucleo_64 (hereafter STM32L476)
STM32F769 Discovery Kit (hereafter STM32F769)
Zephyr 2.1.0-rc1
Project: `samples/subsys/fs/fat_fs`
Logic Analyzer: Analog Discovery 2
 
### Difference
 
I have tested the sample project for microSD/MMC with FatFs (samples/subsys/fs/fat_fs).
 
The project works on some boards, but does not work on one board.
 
A. STM32L476 + SPI1 : O.K.
B. STM32L476 + SPI2 : O.K.
C. STM32F769 + SPI2 : Fail
 
### Logic capture for STM32L476
 
I have captured the SPI logic using Analog Discovery 2.
 
For STM32L476, the captured logics are shown below.





I can see:
 
1. 74 plus alpha clocks
2. MOSI: 0x40 0x00 0x00 0x00 0x00 0x94 0xFF 0xFF 0xFF
 
It works with STM32L476.
 
### Logic capture for STM32F769
 
I also have captured the SPI logic for STM32F769.





I saw:
 
1. 74 plus alpha clocks
2. MOSI: 0x20 0x00 0x00 0x00 0x00 0x4A ...

The step 2 is mistaken not CMD0 (0x40 0x00 0x00 0x00 0x00 0x94), possibly shifted sending.
 
### Possible cause of the failure
 
It seems that the 74 clocks do not end properly (ChipSelect did not go into low with margin).
This may cause the failure to send the CMD0 (0x40) command using STM32F769.
 
I will check how to solve this. But if anyone can suggest to fix this, it helps.
 
P.S. I will see on this after Jan. 3, 2020.
 

Join users@lists.zephyrproject.org to automatically receive all group messages.