interfacing MT29F4G01ABAFDWB nand flash.

i have to interface MT29F4G01ABAFDWB in zephyr rtos but i need help how create overlay file for it(i want to interface it using spi), i already have bare metal drivers for mt29f4g01abafdwb now those i have to move it to zephyr.
i'm using zephyr 2.6
and my controller is nrf52840dk board

Parents
  • hi there,

    &spi1 {
        status = "okay";
        cs-gpios = <&gpio0 4 GPIO_ACTIVE_LOW>;
        pinctrl-0 = <&spi1_default>;
        pinctrl-1 = <&spi1_sleep>;
        pinctrl-names = "default", "sleep";
    
        mt29f4g: mt29f4g@0 {
            compatible = "spi-device"; 
            reg = <0>; 
            spi-max-frequency = <8000000>; 
    
           
        };
    };
    
    &pinctrl {
        spi1_default: spi1_default {
            group1 {
                psels = <NRF_PSEL(SPIM_SCK, 1, 15)>,
                        <NRF_PSEL(SPIM_MISO, 1, 14)>,
                        <NRF_PSEL(SPIM_MOSI, 1, 13)>;
            };
        };
    
        spi1_sleep: spi1_sleep {
            group1 {
                psels = <NRF_PSEL(SPIM_SCK, 1, 15)>,
                        <NRF_PSEL(SPIM_MISO, 1, 14)>,
                        <NRF_PSEL(SPIM_MOSI, 1, 13)>;
                low-power-enable;
            };
        };
    };

    this is the overlay i have created.can please review it once , because im getting this error

    /home/dnk202/nordic/tejas/mt29f4g_external_flash/p1/build/zephyr/include/generated/devicetree_generated.h:14861:32: error: 'DT_N_S_soc_S_spi_40004000_S_mt29f4g_0_P_spi_max_frequency' undeclared here (not in a function); did you mean 'DT_N_S_soc_S_spi_40004000_S_mt29f4g_0_P_reg_IDX_0_EXISTS'?
    14861 | #define DT_N_NODELABEL_mt29f4g DT_N_S_soc_S_spi_40004000_S_mt29f4g_0
    | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    /home/dnk202/ncs/v2.6.0/zephyr/include/zephyr/devicetree.h:4343:29: note: in definition of macro 'DT_CAT3'
    4343 | #define DT_CAT3(a1, a2, a3) a1 ## a2 ## a3
    | ^~
    /home/dnk202/ncs/v2.6.0/zephyr/include/zephyr/drivers/spi.h:332:30: note: in expansion of macro 'DT_PROP'
    332 | .frequency = DT_PROP(node_id, spi_max_frequency), \
    | ^~~~~~~
    /home/dnk202/ncs/v2.6.0/zephyr/include/zephyr/drivers/spi.h:389:27: note: in expansion of macro 'SPI_CONFIG_DT'
    389 | .config = SPI_CONFIG_DT(node_id, operation_, delay_) \
    | ^~~~~~~~~~~~~
    /home/dnk202/nordic/tejas/mt29f4g_external_flash/p1/src/main.c:20:30: note: in expansion of macro 'SPI_DT_SPEC_GET'
    20 | struct spi_dt_spec spispec = SPI_DT_SPEC_GET(DT_NODELABEL(mt29f4g), SPIOP, 0);
    | ^~~~~~~~~~~~~~~
    /home/dnk202/ncs/v2.6.0/zephyr/include/zephyr/devicetree.h:4341:24: note: in expansion of macro 'DT_N_NODELABEL_mt29f4g'
    4341 | #define DT_CAT(a1, a2) a1 ## a2
    | ^~
    /home/dnk202/ncs/v2.6.0/zephyr/include/zephyr/devicetree.h:198:29: note: in expansion of macro 'DT_CAT'
    198 | #define DT_NODELABEL(label) DT_CAT(DT_N_NODELABEL_, label)
    | ^~~~~~
    /home/dnk202/nordic/tejas/mt29f4g_external_flash/p1/src/main.c:20:46: note: in expansion of macro 'DT_NODELABEL'
    20 | struct spi_dt_spec spispec = SPI_DT_SPEC_GET(DT_NODELABEL(mt29f4g), SPIOP, 0);
    | ^~~~~~~~~~~~
    /home/dnk202/nordic/tejas/mt29f4g_external_flash/p1/build/zephyr/include/generated/devicetree_generated.h:14861:32: error: 'DT_N_S_soc_S_spi_40004000_S_mt29f4g_0_P_duplex' undeclared here (not in a function); did you mean 'DT_N_S_soc_S_spi_40004000_S_mt29f4g_0_P_reg'?
    14861 | #define DT_N_NODELABEL_mt29f4g DT_N_S_soc_S_spi_40004000_S_mt29f4g_0
    | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    /home/dnk202/ncs/v2.6.0/zephyr/include/zephyr/devicetree.h:4343:29: note: in definition of macro 'DT_CAT3'
    4343 | #define DT_CAT3(a1, a2, a3) a1 ## a2 ## a3
    | ^~
    /home/dnk202/ncs/v2.6.0/zephyr/include/zephyr/drivers/spi.h:334:25: note: in expansion of macro 'DT_PROP'
    334 | DT_PROP(node_id, duplex) | \
    | ^~~~~~~
    /home/dnk202/ncs/v2.6.0/zephyr/include/zephyr/drivers/spi.h:389:27: note: in expansion of macro 'SPI_CONFIG_DT'
    389 | .config = SPI_CONFIG_DT(node_id, operation_, delay_) \

Reply
  • hi there,

    &spi1 {
        status = "okay";
        cs-gpios = <&gpio0 4 GPIO_ACTIVE_LOW>;
        pinctrl-0 = <&spi1_default>;
        pinctrl-1 = <&spi1_sleep>;
        pinctrl-names = "default", "sleep";
    
        mt29f4g: mt29f4g@0 {
            compatible = "spi-device"; 
            reg = <0>; 
            spi-max-frequency = <8000000>; 
    
           
        };
    };
    
    &pinctrl {
        spi1_default: spi1_default {
            group1 {
                psels = <NRF_PSEL(SPIM_SCK, 1, 15)>,
                        <NRF_PSEL(SPIM_MISO, 1, 14)>,
                        <NRF_PSEL(SPIM_MOSI, 1, 13)>;
            };
        };
    
        spi1_sleep: spi1_sleep {
            group1 {
                psels = <NRF_PSEL(SPIM_SCK, 1, 15)>,
                        <NRF_PSEL(SPIM_MISO, 1, 14)>,
                        <NRF_PSEL(SPIM_MOSI, 1, 13)>;
                low-power-enable;
            };
        };
    };

    this is the overlay i have created.can please review it once , because im getting this error

    /home/dnk202/nordic/tejas/mt29f4g_external_flash/p1/build/zephyr/include/generated/devicetree_generated.h:14861:32: error: 'DT_N_S_soc_S_spi_40004000_S_mt29f4g_0_P_spi_max_frequency' undeclared here (not in a function); did you mean 'DT_N_S_soc_S_spi_40004000_S_mt29f4g_0_P_reg_IDX_0_EXISTS'?
    14861 | #define DT_N_NODELABEL_mt29f4g DT_N_S_soc_S_spi_40004000_S_mt29f4g_0
    | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    /home/dnk202/ncs/v2.6.0/zephyr/include/zephyr/devicetree.h:4343:29: note: in definition of macro 'DT_CAT3'
    4343 | #define DT_CAT3(a1, a2, a3) a1 ## a2 ## a3
    | ^~
    /home/dnk202/ncs/v2.6.0/zephyr/include/zephyr/drivers/spi.h:332:30: note: in expansion of macro 'DT_PROP'
    332 | .frequency = DT_PROP(node_id, spi_max_frequency), \
    | ^~~~~~~
    /home/dnk202/ncs/v2.6.0/zephyr/include/zephyr/drivers/spi.h:389:27: note: in expansion of macro 'SPI_CONFIG_DT'
    389 | .config = SPI_CONFIG_DT(node_id, operation_, delay_) \
    | ^~~~~~~~~~~~~
    /home/dnk202/nordic/tejas/mt29f4g_external_flash/p1/src/main.c:20:30: note: in expansion of macro 'SPI_DT_SPEC_GET'
    20 | struct spi_dt_spec spispec = SPI_DT_SPEC_GET(DT_NODELABEL(mt29f4g), SPIOP, 0);
    | ^~~~~~~~~~~~~~~
    /home/dnk202/ncs/v2.6.0/zephyr/include/zephyr/devicetree.h:4341:24: note: in expansion of macro 'DT_N_NODELABEL_mt29f4g'
    4341 | #define DT_CAT(a1, a2) a1 ## a2
    | ^~
    /home/dnk202/ncs/v2.6.0/zephyr/include/zephyr/devicetree.h:198:29: note: in expansion of macro 'DT_CAT'
    198 | #define DT_NODELABEL(label) DT_CAT(DT_N_NODELABEL_, label)
    | ^~~~~~
    /home/dnk202/nordic/tejas/mt29f4g_external_flash/p1/src/main.c:20:46: note: in expansion of macro 'DT_NODELABEL'
    20 | struct spi_dt_spec spispec = SPI_DT_SPEC_GET(DT_NODELABEL(mt29f4g), SPIOP, 0);
    | ^~~~~~~~~~~~
    /home/dnk202/nordic/tejas/mt29f4g_external_flash/p1/build/zephyr/include/generated/devicetree_generated.h:14861:32: error: 'DT_N_S_soc_S_spi_40004000_S_mt29f4g_0_P_duplex' undeclared here (not in a function); did you mean 'DT_N_S_soc_S_spi_40004000_S_mt29f4g_0_P_reg'?
    14861 | #define DT_N_NODELABEL_mt29f4g DT_N_S_soc_S_spi_40004000_S_mt29f4g_0
    | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    /home/dnk202/ncs/v2.6.0/zephyr/include/zephyr/devicetree.h:4343:29: note: in definition of macro 'DT_CAT3'
    4343 | #define DT_CAT3(a1, a2, a3) a1 ## a2 ## a3
    | ^~
    /home/dnk202/ncs/v2.6.0/zephyr/include/zephyr/drivers/spi.h:334:25: note: in expansion of macro 'DT_PROP'
    334 | DT_PROP(node_id, duplex) | \
    | ^~~~~~~
    /home/dnk202/ncs/v2.6.0/zephyr/include/zephyr/drivers/spi.h:389:27: note: in expansion of macro 'SPI_CONFIG_DT'
    389 | .config = SPI_CONFIG_DT(node_id, operation_, delay_) \

Children
Related