Hello,
We are using Zephyr OS and SDK v2.5.0 on nrf52840 chip. We have noticed some delay between spi_write and spi_read of 29µs,which is critical for our goal. Comparing to the bare metal version this delay is reduced to around 4µs. We wanted to know is there a way to reduce this delay in the Zephyr version?
The following is our SPI configuration and the line of code:
&spi2 { compatible = "nordic,nrf-spim"; status = "okay"; pinctrl-0 = <&spi2_primary_default>; pinctrl-1 = <&spi2_primary_sleep>; pinctrl-names = "default", "sleep"; /*cs-gpios = <&gpio0 24 GPIO_ACTIVE_LOW>;*/ shuttle_spi: device_ex@0 { compatible = "manuf_ex,device_ex"; reg = <0>; spi-max-frequency = <8000000>; status = "okay"; }; };
/*private api to set pin conf*/ set_pin_config(CS_PIN,PIN_DIRECTION_OUT,PIN_VALUE_LOW); rc |= spi_write(spi_spec->bus, &spi_spec->config,&tx); //Zephyr SPI write API rc |= spi_read(spi_spec->bus, &spi_spec->config,&rx); //Zephyr SPI read API set_pin_config(CS_PIN,PIN_DIRECTION_OUT,PIN_VALUE_HIGH);
Regarding the CS line, we commented it from the SPI node def because we want to control it manually from our side since we are using some sensors which provide both SPI and I2C and the bus selection is set by toggling this CS line.
This is a screenshot of baremetal version measurements:
This is a screenshot of Zephyr version measurements:
Thanks!