Hi,
I have NUCLEO-F103RB as the SPI master and NUCLEO-F746ZG as the SPI slave. Both boards have a isoSPI/isolated CAN arudino shield (DC2617A - LTC6820) and I want to use isoSPI between them, so I have connected an ethernet cable between the shields on each board.
In the master (F103RB) I configured the pins:
MOSI = PA_7
MISO = PA_6
SCLK = PA_5
CS = PB_6
And on the slave (F746ZG) the pins are:
MOSI = PA_7
MISO = PA_6
SCLK = PA_5
CS = PD_14
The code does not give out any error, it is a simple code where the master sends a signal and the slave responds with the same signal (the code can be seen below).
Looking at the logic analyzer, MOSI works as it should so the master is working fine. However, MISO is not responding. The logic analyzer is connected to the master’s SPI pins. The MISO channel never goes to 0x00 and never prints “hello” in serial monitor, so the main function doesn’t seem to run (output from the logic analyzer is also attached below).
I thought that maybe there’s something wrong with the jumper connections on the slave, but I get the same results when I change the jumper position on JP1 and JP2.
I feel like there’s something missing. What is wrong?
Master code:
#include "mbed.h"
#include <SPI.h>
#include "stdio.h"
SPI spi(PA_7, PA_6, PA_5);
DigitalOut cs(PB_6);
int main()
{
while(true) {
cs = 1;
spi.format(8,0);
spi.frequency(1000000);
cs = 0;
spi.write(0x69);
cs = 1;
wait_us(1000);
}
}
Slave code:
#include "mbed.h"
#include <SPISlave.h>
#include <cstdio>
#include "stdio.h"
SPISlave spi(PA_7, PA_6, PA_5, PD_14);
BufferedSerial pc(USBTX, USBRX);
int main()
{
spi.reply(0x00); // Prime SPI with first reply
pc.set_baud(115200);
pc.set_format(8,BufferedSerial::None,1);
while (1) {
if (spi.receive()) {
spi.reply(spi.read()); // Make this the next reply
printf("hello");
}
}
}
Logic analyzer:
Thanks,
Miko