Zephyr > microSD(SPIモード接続) + FAT > STM32L476で成功、STM32F769で失敗 > ロジックのモニタ

```txt:動作環境
Ubuntu 18.04 LTS
ボード: STM32L476 Nucleo_64 (以下、STM32L476)
ボード: STM32F769 Discovery Kit (以下、STM32F769)
Zephyr 2.1.0-rc1
microSDモジュール: CK-40 (サンハヤト)
ロジック確認: Analog Discovery 2 (AD2)
```

### 概要

- STM32L476においてmicroSDでFAT読取りに成功 (ファイル名とディレクトリ)
    - `samples/subsys/fs/fat_fs`
- STM32F769において同じプロジェクトは失敗する

両者の何が違うのか。
AD2を用いてロジックの確認をしている。

### STM32L476での波形モニタ

- SPI1で使用

![Screenshot from 2019-12-23 20-34-32.png](https://qiita-image-store.s3.ap-northeast-1.amazonaws.com/0/32870/0620d5fb-b7cc-feab-bf8b-cadbf21ebd08.png)

![Screenshot from 2019-12-23 20-34-41.png](https://qiita-image-store.s3.ap-northeast-1.amazonaws.com/0/32870/eb1e4082-db89-2554-2935-8ed45476bd94.png)

![Screenshot from 2019-12-23 20-34-51.png](https://qiita-image-store.s3.ap-northeast-1.amazonaws.com/0/32870/ebc3358a-25c3-ab14-e8d8-7e2e6c2ff807.png)

![Screenshot from 2019-12-23 20-35-00.png](https://qiita-image-store.s3.ap-northeast-1.amazonaws.com/0/32870/b3f91738-a109-f679-d756-c17a3b856f6f.png)

![Screenshot from 2019-12-23 20-35-51.png](https://qiita-image-store.s3.ap-northeast-1.amazonaws.com/0/32870/a7b10358-9dae-c8cb-063c-6a790ee3209c.png)

![Screenshot from 2019-12-23 20-36-00.png](https://qiita-image-store.s3.ap-northeast-1.amazonaws.com/0/32870/7355d24b-b20c-bf80-78cb-06ee6c4e90ee.png)

![Screenshot from 2019-12-23 20-36-12.png](https://qiita-image-store.s3.ap-northeast-1.amazonaws.com/0/32870/d276e3a3-80fb-7c9a-1679-4755f2d771b0.png)

![Screenshot from 2019-12-23 20-36-35.png](https://qiita-image-store.s3.ap-northeast-1.amazonaws.com/0/32870/7646655b-e46c-6e12-c3b5-85d365595270.png)

![Screenshot from 2019-12-23 20-36-46.png](https://qiita-image-store.s3.ap-northeast-1.amazonaws.com/0/32870/f2249214-d962-b4a1-894b-3ebb1ab09935.png)

### 疑問点

- SPIモード開始用クロック(74クロック)がない

### STM32F769のロジック

- SPI2で使用

```stm32f769i_disco.overlay
/*
2019-12-15
branched from [nrf52840_blip.overlay]
*/

/*
 * Copyright (c) 2019 Tavish Naruka <tavishnaruka@gmail.com>
 *
 * SPDX-License-Identifier: Apache-2.0
 */

&spi2 {
        status = "okay";
        cs-gpios = <&gpioh 6 0>;

        sdhc0: sdhc@0 {
                compatible = "zephyr,mmc-spi-slot";
                reg = <0>;
                status = "okay";
                label = "SDHC0";
                spi-max-frequency = <24000000>;
        };
};
```

![Screenshot from 2019-12-23 21-05-58.png](https://qiita-image-store.s3.ap-northeast-1.amazonaws.com/0/32870/ad9b4c64-48f3-227c-e156-313defe93add.png)

![Screenshot from 2019-12-23 21-06-08.png](https://qiita-image-store.s3.ap-northeast-1.amazonaws.com/0/32870/85804ccb-3976-31b4-6015-f47b1a378b72.png)

![Screenshot from 2019-12-23 21-06-22.png](https://qiita-image-store.s3.ap-northeast-1.amazonaws.com/0/32870/e6969207-815a-824c-390c-537130d8096e.png)

![Screenshot from 2019-12-23 21-06-30.png](https://qiita-image-store.s3.ap-northeast-1.amazonaws.com/0/32870/80c4e6b3-38b8-4dce-5bfa-d7cb0c496812.png)

![Screenshot from 2019-12-23 21-06-41.png](https://qiita-image-store.s3.ap-northeast-1.amazonaws.com/0/32870/4977f8e3-7e9f-ab67-8e33-6e55b6ea0b80.png)

### 備考

- STM32F769のロジックの方はSPIモード開始の74クロックがある
- STM32F476とのロジックとは根本的に違う
- STM32F769の処理は途中で失敗している

gdbで確認中であるが、STM32F769はdisk_spi_sdhc_access_init()からコールされるsdhc_spi_detect()にて失敗しているようだ。