Early GPIO initialisation before main()

Is there a way to initialise a GPIO earlier than in main() without modifying NCS/zephyr code?

We tried an PRE_KERNEL_1 init() function, but this is rather late still.

Might partially be due to CONFIG_ENTROPY_CC3XX=y (https://devzone.nordicsemi.com/f/nordic-q-a/81498/nrf52840-startup-delay).

Is there a way to get before CRYPTOCELL and RNG initialisation?

NCS2.0.2

nRF52840

matter

Parents
  • Hi,

    We tried an PRE_KERNEL_1 init() function, but this is rather late still.

    The initialization level is PRE_KERNEL_1 , but you can try to increase the initialization priority for the init funcion as well. E.g. 

    CONFIG_KERNEL_INIT_PRIORITY_DEVICE-10  (lower values indicate earlier initialization)
  • Using a priority of 41 does not help with the timing.
    Using a priority of 40 creates a kernel panic:

    00> [00:00:00.408,111] <err> os: r0/a1:  0x00000004  r1/a2:  0x000002d4  r2/a3:  0x2002ec18
    00> [00:00:00.408,111] <err> os: r3/a4:  0x00000000 r12/ip:  0x00000000 r14/lr:  0x00020ba5
    00> [00:00:00.408,111] <err> os:  xpsr:  0x61000000
    00> [00:00:00.408,111] <err> os: s[ 0]:  0x00000000  s[ 1]:  0x00000000  s[ 2]:  0x00000000  s[ 3]:  0x00000000
    00> [00:00:00.408,111] <err> os: s[ 4]:  0x00000000  s[ 5]:  0x00000000  s[ 6]:  0x00000000  s[ 7]:  0x00000000
    00> [00:00:00.408,111] <err> os: s[ 8]:  0x00000000  s[ 9]:  0x00000000  s[10]:  0x00000000  s[11]:  0x00000000
    00> [00:00:00.408,111] <err> os: s[12]:  0x00000000  s[13]:  0x00000000  s[14]:  0x00000000  s[15]:  0x00000000
    00> [00:00:00.408,111] <err> os: fpscr:  0x00000000
    00> [00:00:00.408,111] <err> os: Faulting instruction address (r15/pc): 0x000a70f4
    00> [00:00:00.408,111] <err> os: >>> ZEPHYR FATAL ERROR 4: Kernel panic on CPU 0
    00> [00:00:00.408,111] <err> Àì )

  • mabe said:
    Using a priority of 41 does not help with the timing.

    Could you explain this some more? How early do you need it ?Why is it not early enough now?

    mabe said:
    Using a priority of 40 creates a kernel panic:

    That makes sense, since the GPIO driver is initialized at that priority (CONFIG_KERNEL_INIT_PRIORITY_DEFAULT)

  • We need to initialize and set a Gpio to high in the first 300ms or earlier. Using priority 41, we achieve 900ms. We know that the clock and crypto initialization takes time. Is there any way to start prior to them?  

Reply Children
Related