Hello,
I have an LPC55S36 on an Xpresso evaluation board. I have a new requirement: add SPI driver to the software. An SPI driver is therefore being added to an existing project under MCUXpresso IDE v11.9.0 [Build 2144] [2024-01-05].
I've chosen flexcom2 spi, and specified the following pins for the SPI Port. These will be jumpered off-board to another evaluation board once they work. Pins:
SCL P1-23 J122-8
MOSI P0-26 J92-9
MISO P1-25 J122-12
SSEL0 P1-26 J122-6
Clock into flexcomm2 is 32 MHz. The port is initialized in the peripheral init function. A small test program sends a single string to the port at a 1Hz rate. The test function is here:
done = 0;
SPI_MasterTransferCreateHandle (SPI_ADS1X2S14_ADC_PERIPHERAL, &spiHandle, &spiDone, NULL);
xfer.txData = txDataBuffer;
xfer.rxData = rxDataBuffer;
xfer.dataSize = n;
status = SPI_MasterTransferNonBlocking (SPI_ADS1X2S14_ADC_PERIPHERAL, &spiHandle, &xfer);
while (!done)
{
PRINTF ("Waiting...\r\n");
usleep (10000);
}
Where done is a volatile. In loopback mode, the test works. The n-byte test string is deposited in the rx buffer and "done" is set to a nonzero value in the callback function "spiDone".
However, when loopback is turned off and MISO is connected to MOSI, status is 0 (indicating success), done is set (indication completion), the Rx buffer has n values of 0xff (which is not correct), and a scope shows no activity on the SSEL, CLK, and MOSI pins. In this initial test the pins are floating, having no load other than an oscope probe.
My read of the eval board schematic suggests that there are no conflicts for these pins, and no on-board devices that would be interfering with this test (though I may have overlooked something).
Flexcom setup:
Pin routing:
I must have omitted something, though I cannot identify what. Below should be the contents of the Analog/Digital I/O control port for PIO1_23, 25, and 26 which show digital mode, function 1 (is this correct?)
0x400010DC 00000101 00000000 ........
0x400010E4 00000101 00000101 ........
What else can I examine?
Best Regards,
TC