This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

SPI Master is broken in SDK v1.4.x

Hello,

 After a long investigation I got to the conclusion that SPI master (spi3) has been broken in the SDK version 1.4.1.

It is working fine in V1.3.1

I have an application that communicates with Analog Devices MEMS, ADXL335, via SPI.

The application was working fine, until I upgraded to the new SDK v1.4.1 due to some bugs in the cloud APIs.

But then I noticed that the SPI stopped working.

Going back to v1.3.1, the application is back working (the Could API is not Slight smile

Here is my overlay (nrf9160dk_nrf9160ns.overlay)

&spi3 {
compatible = "nordic,nrf-spim";
status = "okay";
sck-pin = <19>;
mosi-pin = <18>;
miso-pin = <17>;
cs-gpios = <&gpio0 10 GPIO_ACTIVE_LOW>;
};

As you see, I am using GPIO 10 as the CS. I noticed that a new member has been added to the spi_cs_control structure (gpio_dt_flags).

struct spi_cs_control           g_spi_cs_ctrl;

g_spi_cs_ctrl.gpio_dev = g_p_gpio_dev;
g_spi_cs_ctrl.gpio_pin = 10;
g_spi_cs_ctrl.delay = 0;
//g_spi_cs_ctrl.gpio_dt_flags = GPIO_OUTPUT_LOW; 

const static struct spi_config spi_cfg =
{
.operation = SPI_OP_MODE_MASTER | SPI_WORD_SET(8) | SPI_LINES_SINGLE | SPI_TRANSFER_MSB, 
.frequency = 500000, /* The frequency in Hz to use when testing in slow mode. Slow: 500000, Fast=16000000 */
.slave = 0, /* Slave number from 0 to host controller slave limit */
.cs = &g_spi_cs_ctrl, /* Chip-Select Control GPIO */
};

In version v.1.3.1 the SPI communication with sensor works fine and I get valid values. In v1.4.1 all the returned values from the sensor are ff or .

I need this issue would be fixed. Because I need both cloud and sensor in my program.

Danny

Parents
  • I just tested an SPI loopback example in NCS v1.4.1 using SPI3 and nRF91 DK. It worked without problems, can you test it out and see if it works for you?

    spi_loopback.zip

    Best regards,

    Simon

  • Hi Simon

     Thanks for your reply.

    The loopback application is working. I already tested it in the past. This simple application uses MISO and MOSI lines only.

    It does not use GPIO as CS line. The problem is with the CS line as I wrote in my original ticket.

    Danny

Reply
  • Hi Simon

     Thanks for your reply.

    The loopback application is working. I already tested it in the past. This simple application uses MISO and MOSI lines only.

    It does not use GPIO as CS line. The problem is with the CS line as I wrote in my original ticket.

    Danny

Children