SPI-NOR driver does not work join to ble uart example

Hi everybody,

I'm working on a project where I want to write in an external flash nor memory, and transfer data over BLE. The combination of the peripherical_uart sample with the nor-flash driver sample running in another thread is a good example of what I'm trying to achieve. But, I couldn't manage to make this combination works. For some reason I always get "SPI flash driver MX25R64 was not found!" if a paste the NOR-FLASH example (and the project.conf)  Inside the peripheral sample, even though the nor-flash sample works out of the box.

I have checked many times the project configuration, all seems to be OK. I'm pasting below, so you can check. PLEASE, HELP ME!!!

# Enable the UART driver
CONFIG_UART_ASYNC_API=y
CONFIG_NRFX_UARTE0=y
CONFIG_SERIAL=y

CONFIG_GPIO=y

# Make sure printk is printing to the UART console
CONFIG_CONSOLE=y

CONFIG_HEAP_MEM_POOL_SIZE=2048

CONFIG_BT=y
CONFIG_BT_PERIPHERAL=y
CONFIG_BT_DEVICE_NAME="Nordic_UART_Service"
CONFIG_BT_DEVICE_APPEARANCE=833
CONFIG_BT_MAX_CONN=1
CONFIG_BT_MAX_PAIRED=1

# Enable the NUS service
CONFIG_BT_NUS=y

# Enable bonding
#CONFIG_BT_SETTINGS=y
#CONFIG_FLASH=y
#CONFIG_FLASH_PAGE_LAYOUT=y
#CONFIG_FLASH_MAP=y
#CONFIG_NVS=y
#CONFIG_SETTINGS=y

# Enable DK LED and Buttons library
CONFIG_DK_LIBRARY=y

# This example requires more workqueue stack
CONFIG_SYSTEM_WORKQUEUE_STACK_SIZE=2048

# Config logger
CONFIG_LOG=y
CONFIG_USE_SEGGER_RTT=y
CONFIG_LOG_BACKEND_RTT=y
CONFIG_LOG_BACKEND_UART=n

CONFIG_ASSERT=y

CONFIG_STDOUT_CONSOLE=y
CONFIG_SPI=y
Parents
  • Hi there,

    Can you post your whole project so I could reproduce the issue?

    regards

    Jared 

  • HI,

    Here you have the source code. I just have copied the flash-nor example inside the main of the ble uart example.

    drive.google.com/.../view

  • I let it commented by mistake when I tried to debug disabling the BT (that's why the "BT" config lines are commented too). I have uncommented it and it doesn't work any way. Please try your self and you will see.

    I dont know what do you mean with flash_map.h. That file it is not included in the SPI-NOR flash example.

    Remember, I just want to joint this to examples:

    ncs\v2.0.0\nrf\samples\bluetooth\peripheral_uart

    ncs\v2.0.0\zephyr\samples\drivers\spi_flash

  • Hi there,

    What board are you building this project for, nRF52840 DK? 

    From documentation: The application will build only for a target that has a devicetree entry with jedec,spi-nor as a compatible.

    I can verify that the application will build regardless of the device tree entry but I see that it fails during runtime with the same error message for the nRF52840 as it doesn't have the devicetree entry.

    You can try to add the child node to the spi node like this if using spi3:

    &spi3 {
    	compatible = "nordic,nrf-spim";
    	status = "okay";
    	pinctrl-0 = <&spi3_default_alt>;
    	pinctrl-1 = <&spi3_sleep_alt>;
    	pinctrl-names = "default", "sleep";
    	cs-gpios = <&gpio0 25 GPIO_ACTIVE_LOW>;
    	mx25r64: mx25r6435f@0 {
    		compatible = "jedec,spi-nor";
    		reg = <0>;
    		spi-max-frequency = <80000000>;
    		label = "MX25R64";
    		jedec-id = [c2 28 17];
    		size = <67108864>;
    	};
    };
    
    &pinctrl {
    	spi3_default_alt: spi3_default_alt {
    		group1 {
    			psels = <NRF_PSEL(SPIM_SCK, 0, 13)>,
    				<NRF_PSEL(SPIM_MOSI, 0, 11)>,
    				<NRF_PSEL(SPIM_MISO, 0, 12)>;
    		};
    	};
    
    	spi3_sleep_alt: spi3_sleep_alt {
    		group1 {
    			psels = <NRF_PSEL(SPIM_SCK, 0, 13)>,
    				<NRF_PSEL(SPIM_MOSI, 0, 11)>,
    				<NRF_PSEL(SPIM_MISO, 0, 12)>;
    			low-power-enable;
    		};
    	};
    
    };
    

    regards

    Jared

  • Hi  , thanks for your answer. Please take a look carefully to the description I wrote. As I said, the ncs\v2.0.0\zephyr\samples\drivers\spi_flash is working fine, the problem is the combination with the BT example (
    ncs\v2.0.0\nrf\samples\bluetooth\peripheral_uart)

    I'm using the board nrf52840_dk.

    Please, test the project or try to reproduce your self and you will understand.

  • Hi,

    Mariano said:
    As I said, the ncs\v2.0.0\zephyr\samples\drivers\spi_flash is working fine,

    I don't quite agree on this. Testing the spi_flash example on the nRF52840 I'm able to reproduce your same issue "SPI flash driver MX25R64 was not found". I had to add CONFIG_FLASH =y to the nrf52840dk_nrf52840.conf file for it work, even though it was already added to the prj.conf file. It seems that the project will ignore the prj.conf file if the board.conf file is included. At this point I'm not 100% sure if this is a bug from our side. But, I therefore suspected that your issue is really with the spi_flash example and not BLE related.

    Either way,

    I tried merging the two examples myself and made sure that the both CONFIG_FLASH=y and CONFIG_NORDIC_QSPI_NOR=y was enabled in the prj.config file. It solved the issue:

    Can you double check that both of these are set in your .config file in your build folder?

    Here is my merged project:

    7838.peripheral_uart.7z

    regards
    Jared

  • Thank you so much . CONFIG_NORDIC_QSPI_NOR=y was the key. It is not fully clear to me why it wasn't present in the prj.conf of the flash nor example, and why I didn't get any build / debug error. Thanks for you kindly effort. 

Reply Children
No Data
Related