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

nrf52832, sd card and accelerometer.

Hello!

I have both SD Card and accelerometer in same SPI bus. Both of them working like charm if another is not present. I'am using app_sdcard from 52 sdk.

Can i use spi manager for my accelerometer or does that effect to sd card drivers?

I have found that SD Card drivers are using gpio to enable and disable CS but problem is that its uses handler. When i try to use same SPI master the sd card:s handler doesn't like data from accelerometer.

I have tried to add NRFX_SPIM_FLAG_NO_XFER_EVT_HANDLER to modified nrf_drv_spi_transfer, but then i don't get any data out and it still gives me

<error> app: ERROR 3 [NRF_ERROR_INTERNAL] at C:\nrf\components\libraries\sdcard\app_sdcard.c:987
PC at: 0x0002D26B

And error is from app_sdcard spi_handler.

As i did have few pins to spare. I seperated SD Card and accelerometer to own busses and it still does not work.

SD Card setup:

CS: pin 11

SCK: 16

MOSI: 17

MISO: 18

Using SPI 2 instance

Accelerometer:

CS: 12

SCK: 5

MOSI: 4

MISO: 3

Using SPI 1 instance

The one which initializes first works and other is not doing anything.

I have another sensor which uses i2c and it uses TWI instance 0

Parents Reply
  • And regarding using the same SPI bus with two slaves,  I need to setup a project here to see what happens with the SD-card driver.

    What you could try is to use two different SPI instances for the two slaves, but use the same GPIO configuration. Then you will have to uninitialize and re-initialize the SPI instance every time you want to start a new transfer, but at least the handlers are separate for the different instances.

    First we would have to figure out why you can only enable one SPI instance at a time though. So please try to disable the TWI instance.

Children
No Data
Related