Hi,
There are 2 SPI device on our custom pcb. Pin connections:
Pins of 1st:
#define bmx_miso1 22
#define bmx_mosi 19
#define bmx_sck 20
Pins of 2nd:
#define bmx_miso2 18
#define bmx_mosi 19
#define bmx_sck 20
Clock,Mosi lines are common pins. Miso and CS lines are different pins.
In the initialization, we only select one SPI slave.
void initialize_spi(void)
{
pin_set(bmx_cs1);
pin_set(bmx_cs2);
NRF_SPIM0->PSEL.SCK = bmx_sck;
NRF_SPIM0->PSEL.MOSI = bmx_mosi;
NRF_SPIM0->PSEL.MISO = bmx_miso1;
}
But we need read both device in turn in a while loop.
Should i reinitialize SPIM peripheral every time when reading other device? What is the propor way of this?
Sould i do that?
first
NRF_SPIM0->PSEL.MISO = bmx_miso1;
then
NRF_SPIM0->PSEL.MISO = bmx_miso2;
again first again second... Contiuously changing SPI MISO pin, is it the way?
Best Regards