Hi - I am seeking clarification on a topic as I am a little unsure on the correct way to do things.
I'm using an nRF52840 and porting an old Firmware from nRF5 SDK to NCS.
One SPI is used in a very simple and standard way. Another SPI is used via the PPI to sample an Accelerometer accurately at a high data rate.
The SPI that uses the PPI will obviously use the NRFX SPIM and for the other simple SPI I want to use the Zephyr API.
I'm seeing mixed reports in my research as to how best achieve this. In this example I see that the SPI to be used via NRFX SPIM is still defined in the device tree as disabled.
/* The following two nodes (corresponding to the SPIM2 and UARTE2 peripherals, * respectively) need to be disabled so that Zephyr drivers won't initialize * those instances; the application will use them via nrfx drivers. But their * pins must be specified, as the application expects to get this information * from devicetree. */ &spi2 { compatible = "nordic,nrf-spim"; status = "disabled"; pinctrl-0 = <&spi2_default_alt>; /delete-property/ pinctrl-1; pinctrl-names = "default"; cs-gpios = <&gpio1 6 GPIO_ACTIVE_LOW>; };
Then, in the code, it seems to install a shared interrupt handler:
/* Install a shared interrupt handler for peripherals used via * nrfx drivers. It will dispatch the interrupt handling to the * driver for the currently initialized peripheral. */ BUILD_ASSERT( DT_IRQ(SPIM_NODE, priority) == DT_IRQ(UARTE_NODE, priority), "Interrupt priorities for SPIM_NODE and UARTE_NODE need to be equal."); IRQ_CONNECT(DT_IRQN(SPIM_NODE), DT_IRQ(SPIM_NODE, priority), nrfx_isr, nrfx_prs_box_2_irq_handler, 0);
Is this the correct way to do things?
This example also seems to suggest that the two devices with different API's cannot be used simultaneously? Can you clarify that also?