7 years, 2 months ago.

FRDM-K64F Why are two separate SPI peripherals seemingly conflicting?

Im using a Wiznet WIZ550io SPI ethernet board, while also communicating via SPI to an STM32F411RET6 both acting as slave to the K64F. Initially i had them sharing the same SPI peripheral, with different CS, which should work if they play nice and take turns as they should... (SPI_0).

I moved the Ethernet module to the WiFi SPI breakout (SPI_1). I have checked the PeripheralPins.c configuration, and everything is correct there, no conflict. However when the F411 comes online using SPI_0, the connection to SPI_1 seems to hang/lose comms...

INTER-CHIP COMMS SPI

DigitalOut comCS(PTD0, 1);
SPI com(PTD2, PTD3, PTD1);

Wiznet W550io SPI

EthernetInterface eth(PTD6, PTD7, PTD5, PTD4, PTC0);

I tried changing PTC0 Reset pin to a GPIO from ADC_SE14, but that didnt help.

PeripheralPins.c

const PinMap PinMap_ADC[] = {
    {PTC0 , PTC0, 1}, //ADC0_SE14
};

/************SPI***************/
const PinMap PinMap_SPI_SCLK[] = {
    {PTD1 , SPI_0, 2}, //Was 2
    {PTE2 , SPI_1, 2},
    {PTA15, SPI_0, 2},
    {PTB11, SPI_1, 2},
    {PTB21, SPI_2, 2},
    {PTC5 , SPI_0, 2},
    {PTD5 , SPI_1, 7},
    {NC   , NC   , 0}
};

const PinMap PinMap_SPI_MOSI[] = {
    {PTD2 , SPI_0, 2}, //Was 2
    {PTE1 , SPI_1, 2},
    {PTE3 , SPI_1, 7}, //Was 7
    {PTA16, SPI_0, 2},
    {PTB16, SPI_1, 2},
    {PTB22, SPI_2, 2},
    {PTC6 , SPI_0, 2},
    {PTD6 , SPI_1, 7},
    {NC   , NC   , 0}
};

const PinMap PinMap_SPI_MISO[] = {
    {PTD3 , SPI_0, 2}, //Was 2
    {PTE1 , SPI_1, 7}, //Was 7
    {PTE3 , SPI_1, 2},
    {PTA17, SPI_0, 2},
    {PTB17, SPI_1, 2},
    {PTB23, SPI_2, 2},
    {PTC7 , SPI_0, 2},
    {PTD7 , SPI_1, 7},
    {NC   , NC   , 0}
};

const PinMap PinMap_SPI_SSEL[] = {
    {PTD0 , SPI_0, 2}, //Was 2
    {PTE4 , SPI_1, 2},
    {PTA14, SPI_0, 2},
    {PTB10, SPI_1, 2},
    {PTB20, SPI_2, 2},
    {PTC4 , SPI_0, 2},
    {PTD4 , SPI_1, 7},
    {NC   , NC   , 0}
};

The moment the F411 stops accepting SPI from the K64F, the Ethernet SPI resumes...

Any ideas whats happening? Thanks

I don't really see a reason why this should happen. Do you happen to have a logic analyzer? And what is your program doing with the F411 via SPI?

posted by Erik - 01 Feb 2017

I do not i'm afraid. The F411 is doing some IO Thread processing to take load off of the K64F, which has been having some thread related issues. The SPI is to pass a dense command of 1 byte from one MCU to the other, allowing for syncronising of processes.

posted by Angus Hutton-McKenzie 01 Feb 2017

For sure I would advice you to get one. They are on ebay for next to nothing and really handy to have :).

But if I understand it correctly if you for example keep reset button on the F401 pressed it works properly? What about if you remove wires? Are the grounds connected of the two boards? (Probably anyway via supply, but can't hurt to check it).

posted by Erik - 01 Feb 2017

I will look into that, thanks. The ground is definitely shared, and yes, if the F411 is in reset hold the ethernet connect continues to run. The F411 is actually chip only on a custom PCB, where as the K64F is the dev board, attached to the PCB like a shield. I tried the WIZ550io again on its own running on the F411 and thats having some trouble, so i think im going to try building a new board, incase the problem is on the ethernet breakout.

posted by Angus Hutton-McKenzie 01 Feb 2017

Thanks for your help so far Erik. The WIZ550io was nothing but trouble. Seeing as i have the K64F with Ethernet, ive decided to do away with it. Almost everything i set out to achieve seems to work. Problem now is that the UDPSocket::sendto is returning -3003 (NSAPI_ERROR_PARAMETER). Any thoughts?

posted by Angus Hutton-McKenzie 03 Feb 2017
Be the first to answer this question.