This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

NRF9160 Board for Qr Code Project

I closed the previous discussion by mistake: https://devzone.nordicsemi.com/f/nordic-q-a/83067/nrf9160-board-for-qr-code-project?ReplySortBy=CreatedDate&ReplySortOrder=Ascending

None can read the QR code directly because the QR Code is in a secure anti-tamper location with reliable staff. So we need to make secure the transmission.

How we can see what we are using? We didn't touch anything about the domain of the example so probably we are using the SPM.

These are the logs when we try to execute the uart in non secure domain:

2022-03-08T14:46:31.601Z DEBUG modem << * Booting Zephyr OS build v2.6.99-ncs1-1  *
2022-03-08T14:46:31.604Z DEBUG modem << Flash regionsDomainPermissions
2022-03-08T14:46:31.611Z DEBUG modem << 00 01 0x00000 0x10000 Securerwxl
2022-03-08T14:46:31.612Z DEBUG modem << 02 31 0x10000 0x100000 Non-Securerwxl
2022-03-08T14:46:31.614Z DEBUG modem << Non-secure callable region 0 placed in flash region 1 with size 32.
2022-03-08T14:46:31.616Z DEBUG modem << SRAM regionDomainPermissions
2022-03-08T14:46:31.617Z DEBUG modem << 00 07 0x00000 0x10000 Securerwxl
2022-03-08T14:46:31.619Z DEBUG modem << 08 31 0x10000 0x40000 Non-Securerwxl
2022-03-08T14:46:31.620Z DEBUG modem << PeripheralDomainStatus
2022-03-08T14:46:31.622Z DEBUG modem << 00 NRF_P0               Non-SecureOK
2022-03-08T14:46:31.624Z DEBUG modem << 01 NRF_CLOCK            Non-SecureOK
2022-03-08T14:46:31.625Z DEBUG modem << 02 NRF_RTC0             Non-SecureOK
2022-03-08T14:46:31.626Z DEBUG modem << 03 NRF_RTC1             Non-SecureOK
2022-03-08T14:46:31.628Z DEBUG modem << 04 NRF_NVMC             Non-SecureOK
2022-03-08T14:46:31.629Z DEBUG modem << 05 NRF_UARTE1           Non-SecureOK
2022-03-08T14:46:31.630Z DEBUG modem << 06 NRF_UARTE2           SecureSKIP
2022-03-08T14:46:31.631Z DEBUG modem << 07 NRF_TWIM2            Non-SecureOK
2022-03-08T14:46:31.633Z DEBUG modem << 08 NRF_SPIM3            Non-SecureOK
2022-03-08T14:46:31.634Z DEBUG modem << 09 NRF_TIMER0           Non-SecureOK
2022-03-08T14:46:31.635Z DEBUG modem << 10 NRF_TIMER1           Non-SecureOK
2022-03-08T14:46:31.636Z DEBUG modem << 11 NRF_TIMER2           Non-SecureOK
2022-03-08T14:46:31.637Z DEBUG modem << 12 NRF_SAADC            Non-SecureOK
2022-03-08T14:46:31.639Z DEBUG modem << 13 NRF_PWM0             Non-SecureOK
2022-03-08T14:46:31.640Z DEBUG modem << 14 NRF_PWM1             Non-SecureOK
2022-03-08T14:46:31.641Z DEBUG modem << 15 NRF_PWM2             Non-SecureOK
2022-03-08T14:46:31.667Z DEBUG modem << 16 NRF_PWM3             Non-SecureOK
2022-03-08T14:46:31.670Z DEBUG modem << 17 NRF_WDT              Non-SecureOK
2022-03-08T14:46:31.672Z DEBUG modem << 18 NRF_IPC              Non-SecureOK
2022-03-08T14:46:31.674Z DEBUG modem << 19 NRF_VMC              Non-SecureOK
2022-03-08T14:46:31.677Z DEBUG modem << 20 NRF_FPU              Non-SecureOK
2022-03-08T14:46:31.681Z DEBUG modem << 21 NRF_EGU1             Non-SecureOK
2022-03-08T14:46:31.684Z DEBUG modem << 22 NRF_EGU2             Non-SecureOK
2022-03-08T14:46:31.686Z DEBUG modem << 23 NRF_DPPIC            Non-SecureOK
2022-03-08T14:46:31.688Z DEBUG modem << 24 NRF_REGULATORS       Non-SecureOK
2022-03-08T14:46:31.689Z DEBUG modem << 25 NRF_PDM              Non-SecureOK
2022-03-08T14:46:31.692Z DEBUG modem << 26 NRF_I2S              Non-SecureOK
2022-03-08T14:46:31.694Z DEBUG modem << 27 NRF_GPIOTE1          Non-SecureOK
2022-03-08T14:46:31.695Z DEBUG modem << SPM: NS image at 0x10000
2022-03-08T14:46:31.697Z DEBUG modem << SPM: NS MSP at 0x20018af8
2022-03-08T14:46:31.698Z DEBUG modem << SPM: NS reset vector at 0x16d81
2022-03-08T14:46:31.700Z DEBUG modem << SPM: prepare to jump to Non-Secure image.
2022-03-08T14:46:31.702Z DEBUG modem << * Booting Zephyr OS build v2.6.99-ncs1-1  *


We are reading from the UART using exactly the lpuart of the example online (https://developer.nordicsemi.com/nRF_Connect_SDK/doc/1.7.1/nrf/samples/peripheral/lpuart/README.html) and we think that the data from the QR code scanner are stored like a string.
Parents
  • What data is stored in the QR codes?

    How is it formatted? Does it have a fixed length?

    If not, I see from the data sheet of the QR scanner that it can append a suffix for the data, so that you know where the data ends.

    How is your project configured?

    If you based your UART code on the lpuart sample, did you update the name of the config files to reflect that you are now building for "the non-secure board"?

    You also say that you are going to use GPS. I assume you want the position of the QR code?

    That will be difficult if the QR code is indoors, as the GPS signals aren't strong enough to be received indoors.

    Edit: Also, could you make sure CONFIG_LOG=y and CONFIG_RESET_ON_FATAL_ERROR=n is set? That might help us get more logs. Also, you need to make sure that UART0 has not been disabled.

  • In Qr codes probably are stores numbers, but we don't know for sure and we don't know its length too.

    We found a way a bit chaotic to take the data but we really need to clean the buffer after each read.

    What do you mean with:

    How is your project configured?

    How should we do this? 

    If you based your UART code on the lpuart sample, did you update the name of the config files to reflect that you are now building for "the non-secure board"?

    For the GPS maybe we are going to provide an Antenna.

    How should we do this? 

    Also, you need to make sure that UART0 has not been disabled.

    We disabled this 

    CONFIG_RESET_ON_FATAL_ERROR=n

    With non-secure domain:
    -If I set UART0--> Failed to set callback

    These are the logs:

    2022-03-09T16:27:30.328Z DEBUG modem << ASSERTION FAIL [err == 0] @ CMAKE_SOURCE_DIR/src/main.c:117
    2022-03-09T16:27:30.331Z DEBUG modem << Failed to set callback
    2022-03-09T16:27:30.340Z DEBUG modem << [00:00:01.017,181] [1;31m<err> os: r0/a1:  0x00000004  r1/a2:  0x00000075  r2/a3:  0x00000001[0m
    2022-03-09T16:27:30.374Z DEBUG modem << [00:00:01.017,272] [1;31m<err> os: r3/a4:  0x00000018 r12/ip:  0x00001000 r14/lr:  0x00011189[0m
    2022-03-09T16:27:30.376Z DEBUG modem << [00:00:01.017,272] [1;31m<err> os:  xpsr:  0x41000000[0m
    2022-03-09T16:27:30.378Z DEBUG modem << [00:00:01.017,303] [1;31m<err> os: Faulting instruction address (r15/pc): 0x00023b2c[0m
    2022-03-09T16:27:30.380Z DEBUG modem << [00:00:01.017,333] [1;31m<err> os: >>> ZEPHYR FATAL ERROR 4: Kernel panic on CPU 0[0m
    2022-03-09T16:27:30.381Z DEBUG modem << [00:00:01.017,333] [1;31m<err> os: Current thread: 0x20014b08 (unknown)[0m
    2022-03-09T16:27:30.383Z DEBUG modem << [00:00:01.062,927] [1;31m<err> os: Halting system[0m


    -If I set UART1--> Failed to get the device

    These are the logs:

    2022-03-09T16:25:54.670Z DEBUG modem << ASSERTION FAIL [lpuart] @ CMAKE_SOURCE_DIR/src/main.c:140
    2022-03-09T16:25:54.699Z DEBUG modem << Failed to get the device
    2022-03-09T16:25:54.701Z DEBUG modem << [00:00:01.017,211] [1;31m<err> os: r0/a1:  0x00000004  r1/a2:  0x0000008c  r2/a3:  0x00000001[0m
    2022-03-09T16:25:54.703Z DEBUG modem << [00:00:01.017,303] [1;31m<err> os: r3/a4:  0x0000001a r12/ip:  0x00001000 r14/lr:  0x0001128f[0m
    2022-03-09T16:25:54.705Z DEBUG modem << [00:00:01.017,303] [1;31m<err> os:  xpsr:  0x41000000[0m
    2022-03-09T16:25:54.727Z DEBUG modem << [00:00:01.017,333] [1;31m<err> os: Faulting instruction address (r15/pc): 0x00023b2c[0m
    2022-03-09T16:25:54.747Z DEBUG modem << [00:00:01.017,364] [1;31m<err> os: >>> ZEPHYR FATAL ERROR 4: Kernel panic on CPU 0[0m
    2022-03-09T16:25:54.750Z DEBUG modem << [00:00:01.017,395] [1;31m<err> os: Current thread: 0x20014b08 (unknown)[0m
    2022-03-09T16:25:54.752Z DEBUG modem << [00:00:01.062,957] [1;31m<err> os: Halting system[0m

Reply
  • In Qr codes probably are stores numbers, but we don't know for sure and we don't know its length too.

    We found a way a bit chaotic to take the data but we really need to clean the buffer after each read.

    What do you mean with:

    How is your project configured?

    How should we do this? 

    If you based your UART code on the lpuart sample, did you update the name of the config files to reflect that you are now building for "the non-secure board"?

    For the GPS maybe we are going to provide an Antenna.

    How should we do this? 

    Also, you need to make sure that UART0 has not been disabled.

    We disabled this 

    CONFIG_RESET_ON_FATAL_ERROR=n

    With non-secure domain:
    -If I set UART0--> Failed to set callback

    These are the logs:

    2022-03-09T16:27:30.328Z DEBUG modem << ASSERTION FAIL [err == 0] @ CMAKE_SOURCE_DIR/src/main.c:117
    2022-03-09T16:27:30.331Z DEBUG modem << Failed to set callback
    2022-03-09T16:27:30.340Z DEBUG modem << [00:00:01.017,181] [1;31m<err> os: r0/a1:  0x00000004  r1/a2:  0x00000075  r2/a3:  0x00000001[0m
    2022-03-09T16:27:30.374Z DEBUG modem << [00:00:01.017,272] [1;31m<err> os: r3/a4:  0x00000018 r12/ip:  0x00001000 r14/lr:  0x00011189[0m
    2022-03-09T16:27:30.376Z DEBUG modem << [00:00:01.017,272] [1;31m<err> os:  xpsr:  0x41000000[0m
    2022-03-09T16:27:30.378Z DEBUG modem << [00:00:01.017,303] [1;31m<err> os: Faulting instruction address (r15/pc): 0x00023b2c[0m
    2022-03-09T16:27:30.380Z DEBUG modem << [00:00:01.017,333] [1;31m<err> os: >>> ZEPHYR FATAL ERROR 4: Kernel panic on CPU 0[0m
    2022-03-09T16:27:30.381Z DEBUG modem << [00:00:01.017,333] [1;31m<err> os: Current thread: 0x20014b08 (unknown)[0m
    2022-03-09T16:27:30.383Z DEBUG modem << [00:00:01.062,927] [1;31m<err> os: Halting system[0m


    -If I set UART1--> Failed to get the device

    These are the logs:

    2022-03-09T16:25:54.670Z DEBUG modem << ASSERTION FAIL [lpuart] @ CMAKE_SOURCE_DIR/src/main.c:140
    2022-03-09T16:25:54.699Z DEBUG modem << Failed to get the device
    2022-03-09T16:25:54.701Z DEBUG modem << [00:00:01.017,211] [1;31m<err> os: r0/a1:  0x00000004  r1/a2:  0x0000008c  r2/a3:  0x00000001[0m
    2022-03-09T16:25:54.703Z DEBUG modem << [00:00:01.017,303] [1;31m<err> os: r3/a4:  0x0000001a r12/ip:  0x00001000 r14/lr:  0x0001128f[0m
    2022-03-09T16:25:54.705Z DEBUG modem << [00:00:01.017,303] [1;31m<err> os:  xpsr:  0x41000000[0m
    2022-03-09T16:25:54.727Z DEBUG modem << [00:00:01.017,333] [1;31m<err> os: Faulting instruction address (r15/pc): 0x00023b2c[0m
    2022-03-09T16:25:54.747Z DEBUG modem << [00:00:01.017,364] [1;31m<err> os: >>> ZEPHYR FATAL ERROR 4: Kernel panic on CPU 0[0m
    2022-03-09T16:25:54.750Z DEBUG modem << [00:00:01.017,395] [1;31m<err> os: Current thread: 0x20014b08 (unknown)[0m
    2022-03-09T16:25:54.752Z DEBUG modem << [00:00:01.062,957] [1;31m<err> os: Halting system[0m

Children
  • Gioele said:
    In Qr codes probably are stores numbers, but we don't know for sure and we don't know its length too.

    But what does the data mean? Why is it so important that it is kept secret?

    Gioele said:

    What do you mean with:

    How is your project configured?

    What options have you set in your prj.conf file, or with menuconfig or similar tools?

    What device tree overlay files do you have, and what do they contain?

    Gioele said:

    How should we do this? 

    If you based your UART code on the lpuart sample, did you update the name of the config files to reflect that you are now building for "the non-secure board"?

    "the non-secure board" has an "_ns" suffix to the name.

Related