6 years, 3 months ago.

SPI_SSEL on F767ZI issues

I'm trying to use the built-in support for the hardware chip select when using SPI.

This code:

#include "mbed.h"

SPI device(SPI_MOSI, SPI_MISO, SPI_SCK, SPI_SSEL);

int main()
{
    device.format(16,0); //16 bits per frame, mode 0
    while(1) {
        device.write(0xAA);
        wait(.5);
    }
}

generates a compile time error: Undefined identifier SPI_SSEL. Looking at PinNames.h, on the F767ZI page, the SPI section shows SPI_CS instead of SPI_SSEL. If I use that in the SPI declaration, it compiles OK, but I get a runtime error when attempting to run it: PinMap not found or something similar, printed to the console port.

If I use PA_4 instead of SPI_SSEL or SPI_CS, it compiles, and there is no runtime error, but the SPI doesn't work. No chip select signal, no clocks, no data.

I found an old question along these lines where one suggested answer was that hardware chip select is only used for SPI slave, but this can not be right. It's listed in the SPI class documentation and the example in the SPI class documentation even shows (albeit commented out) how one would use it (which is where the code above came from). If it was just for slave, it would only be in SPI_Slave.

Yes, I know I can just use a digitalOut and handle the CS in software, which is what I have been doing, but according to all the documentation I can find, this ought to work.

Be the first to answer this question.