initialize pin before booting device.

Hi ,

      I want to use a pin on board, which is not used or initialized in dts file . my requirement is that I want to initialize that pin before booting process. ( that pin act as power supply for my external flash device). so kindly suggest on that. why before booting process is, while performing dfu from external flash after booting it is directly checking the flash related thing so before that i need to set that pin as high .

note - I have tried with SYS_INIT(); but it is not working . 

E: Device id 00 00 00 does not match config 9d 40 13
*** Booting Zephyr OS build v2.7.99-ncs1-1  ***
I: Starting bootloader


 inside boot_read_sectors fun


*** inside flash_map_layout file inside flash area get sector


*** inside flash_map_layout file inside flash area get sector
W: Failed reading sectors; BOOT_MAX_IMG_SECTORS=128 - too small?

*************** inside loader.c file ***************


********inside flash map.c crashing due to get bind **


*** inside flash map.c file inside the flash area read **
E: ***** BUS FAULT *****
E:   Instruction bus error
E: r0/a1:  0x00000000  r1/a2:  0x00000000  r2/a3:  0x200002cc
E: r3/a4:  0x00000020 r12/ip:  0x0af7fbb5 r14/lr:  0x000010cf
E:  xpsr:  0x61000000
E: Faulting instruction address (r15/pc): 0x0af7fbb4
E: >>> ZEPHYR FATAL ERROR 0: CPU exception on CPU 0
E: Current thread: 0x20000210 (unknown)
E: Resetting system
E: Device id 00 00 00 does not match config 9d 40 13
*** Booting Zephyr OS build v2.7.99-ncs1-1  ***
I: Starting bootloader

Error is - E: Device id 00 00 00 does not match config 9d 40 13

Parents
  • Hi,

    During reset the state of the IC is undefined, to there is no way to ensure that the pin is always high before booting form only SW. For that, you would need an external pull resistor to control this, and also not power the external flash directly from the GPIO (not sure if you do that, though). Without it, I guess the question is how early in the boot process you can configure the GPIO pin as an output and set it to high? It seems like you need this external flash in MCUBoot, and so doing this when the Zephyr application starts is too late. But as setting a GPIO is quite straight forward if you just use the HAL (modules/hal/nordic/nrfx/hal/nrf_gpio.h) to access the registers directly, I suggest looking into doing that early in the main function of MCUboot (bootloader/mcuboot/boot/zephyr/main.c).

  • hi, 

    I suggest looking into doing that early in the main function of MCUboot

    i tried this but no luck. now the issue is before entering to the main of bootloader , the fun is verifying the SPI Connectivity by reading the JDEC-ID  , in the spi_noc.c function (i.e. spi_nor_configuration function). there am getting this error.

    E: Device id 00 00 00 does not match config 9d 40 13

    so , what am assuming here is it is not able to get the external flash device id (jdec id). Kindly guide me how to tackle that .

    regards,

    shikamaru

  • Hi Shikamaru,

    Does this work if you power the flash IC externally as an experiment to verify that the issue is really that it is not powered in time?

    One simple idea came to mind: Do you always want to power up the external flash when booting, and are you confident that this will never change? If so, perhaps you can do set this GPIO pin already in the first stage (immutable) bootloader, if you use that (if you don't, it often makes sense to consider using one for other reasons as well)?

  • Thanks Einar,

     it got solved. it is mistake in mcuboot .conf file. now am getting device id correctly.

    Regards,

    Shikamaru

Reply Children
No Data
Related