Is there any sample for spi based on nrf5340?
Is there any sample for spi based on nrf5340?
Do you get another window before that?
The problem is probably that UART0 is already used. As I said, they share the same peripheral on the nRF53, so only one of UART0, SPI0, and TWI0 can be enabled at the same time.
You also probably have to enable the SPI node in the device tree.
Yes, UART0 enabled for log
But UART0 and SPI0 seem to be different instantiations
I change SPI0 to SPI1,the configuration passed,and log changed.
Hi.
sean said:But UART0 and SPI0 seem to be different instantiations
Are you certain that you are looking at the right datasheet? For me, they are the same:
I have been able to port my colleague's sample to nrf5340_dk_nrf5340_cpuappns (notice the "ns" at the end. The sample only builds for the non-secure version of the board).
As you can see from the overlay file, pins 4,5 and 6 are used by SPI_1. If you connect pins 4 & 5, you will see the sent value being looped back.
You can find the modified sample attached (I left the compiled hex file).
Best regards,
Didrik
Hi, Didrik
Thanks very much! It works.
Sorry,I mix with 52840's datasheet.
And at first, in nrf5340_dk_nrf5340_cpuappns configuration,I download zephyr.hex,it didn't log any thing,so I allways use nrf5340_dk_nrf5340_cpuapp configuration.
Thanks again!
sean said:And at first, in nrf5340_dk_nrf5340_cpuappns configuration,I download zephyr.hex,it didn't log any thing,so I allways use nrf5340_dk_nrf5340_cpuapp configuration.
For the non-secure configuration, you need to use merged.hex. When the application is running as non-secure, it needs another "application" to set up the CPU and peripherals first, such as the Secure Partition Manager (SPM).
When building your application as non-secure, the SPM sample gets built automatically, and the hex files are merged into "merged.hex".
I've added some links to the relevant documentation below:
https://developer.nordicsemi.com/nRF_Connect_SDK/doc/1.2.0/nrf/samples/nrf9160/spm/README.html
https://developer.nordicsemi.com/nRF_Connect_SDK/doc/1.2.0/nrf/include/spm.html
https://developer.nordicsemi.com/nRF_Connect_SDK/doc/1.2.0/nrf/ug_multi_image.html