Unable to get SPIM peripheral to use CSN signal

Hello,

I want to combine multiple peripherals in a nrf53 using DPPI to one, complex peripheral. That's why I directly program against the peripheral documentation and use the peripheral layout definitions from hal/nordic/nrfx/mdk/nrf5340_application.h and do not use the abstractions provided by Zephyr, even thought the application is Zephyr based (as we later need to add Bluetooth).

To get to the final state, I planned to start by implementing a simple SPI transaction. The nrf53 is the SPI master and should implement SPI mode 0. I configure MOSI, CSN and SCK as outputs and set the output level to low.

When I start the transaction, by triggering TASKS_START and waiting for EVENTS_END, MOSI and CLK behave like expected, the CSN pins stays low.

I made some weird observations:

  •  STALLSTATE is always 1, even after setting the register explicitly to 0. Reading it afterwards yields always 1.
  •  A lot of registers do not have their documented default values:
    • PSELDCX is 0, not ~0.
    • IFTIMING.CSNDUR is 1, not 2

      STALLSTAT is 1, not 0

  • I've set PSELDCX explicitly to 0xffffffff and it reads then as 0x11f

I tried:

  • using NRF_SPIM1_S and NRF_SPIM2_S (to make sure, that the peripheral is not used by other parts of zephyr)
  • Logged the address of some registers (for example STALLSTAT to make sure, that I'm really coping with the correct peripheral)
  • Switched pins (CLK and CSN) to make sure, that there is no hardware problem
  • Changing FREQUENCY -> works
  • Configuring CSNPOL explicitly to 0

The nrf53 is installed on a PCA10095 Version 2.0.1. I think, I can read QKAAD0 on the chip.

What else can I try? What can I do to get closer to the cause of my problem?

thanks in advance 

Torsten

Related