SAMD21 Pro RF and Micro SD

Hi,

I am a very happy user of the SAMD21 Pro RF board, and am using it in an industrial application. I would like to use both the on board RF board, and I would like to implement a microSD card to log data.

Is there any concern with having both functions? I believe both will use the MISO, MOSI and SCK pins. Is there anyway to preferentially use the pins for the microSD, and the switch over to using those pins for the RF board.

One way would be to use a analogue switch as a separate IC, and to switch the lines through that. However, this will be difficult to do with the RF board already integrated into the SAMD21 Pro RF product.

Does anyone have any thoughts, or previous experience with doing this?

Many thanks,

Ross

Hi Ross.

You’d need to setup your code to treat a SD card preferentially over the RFM95 radio. Both the radio and SD card can share the same SPI bus though and switching between both devices would be done with the CS pin on both the radio and SD card.

Thank you Chris! So if I understand it correctly, my program flow would be something like:

// Micro SD stuff

set the D12 pin high (D12 is the RFM95 CS pin), to disable the RFM95

set my MicroSD CS pin low to enable the MicroSD, (pin is whatever I decide to connect to)

use the SPI bus to write to MicroSD

// Radio stuff

set MicroSD CS pin to high to disable MicroSD

set D12 pin low to enable the RFM95

use the SPI bus to write to RFM9M, do transmission and reception etc.

Ross