SPI ERROR

when I change from compatible = "nordic,nrf-spi"; to compatible = "nordic,nrf-spim";

the SPI transceive failed 

my overlay file 

Fullscreen
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
&spi1 {
compatible = "nordic,nrf-spim";
status = "okay";
pinctrl-0 = <&spi1_default>;
pinctrl-1 = <&spi1_sleep>;
pinctrl-names = "default","sleep";
cs-gpios = <&gpio0 17 GPIO_ACTIVE_LOW>; // CS
// def-char = <0xFF>; //
w25m02g: w25m02g@0 {
compatible = "winbond,w25m02g";
reg = <0>;
spi-max-frequency = <8000000>;
size = <2147483648>;
wp-gpios = <&gpio0 14 GPIO_ACTIVE_LOW>;
hold-gpios = <&gpio0 16 GPIO_ACTIVE_LOW>;
};
};
&pinctrl {
spi1_default: spi1_default {
group1 {
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

my yaml file 

Fullscreen
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
# Copyright (c) 2020 Nordic Semiconductor ASA
# SPDX-License-Identifier: Apache-2.0
description: Winbond W25M02G SPI flash
compatible: "winbond,w25m02g"
#include: [spi-device.yaml, pinctrl-device.yamlsensor-device.yaml]
include: [spi-device.yaml, sensor-device.yaml]
properties:
size:
type: int
default: 2147483648
description: Flash capacity in bits.
wp-gpios:
type: phandle-array
required: false
description: /WP pin
hold-gpios:
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

main code 

Fullscreen
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
#include <zephyr/device.h>
#include <zephyr/devicetree.h>
// #include <zephyr/drivers/sensor.h>
#include <zephyr/drivers/gpio.h>
#include <zephyr/kernel.h>
#include <zephyr/logging/log.h>
#include <zephyr/drivers/spi.h>
#include <zephyr/drivers/gpio.h>
#include <stdio.h>
#include <string.h>
// int main(void)
// {
// printf("Hello World! %s\n", CONFIG_BOARD);
// return 0;
// }
LOG_MODULE_REGISTER(w25m02g_example);
// SPI configuration
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX