I am having a weird issue with the SPI bus on LPC4357, with a logic analyzer the SSEL line gets pulled down and data is seen on the MOSI however there is no clock signal on SCK.
I have tried SSP0 and SSP1 but both have the same issue and I can't figure out why.
Currently is setup to SSP1 with following pin configuration (board.c):
Code: Select all
LPC_SCU->SFSPF_4 = (1<<4) | 0x00; // SCK FUNC 0 pull inactive
LPC_SCU->SFSPF_5 = 0x02; //SSEL FUNC 2 pull up
LPC_SCU->SFSPF_6 = (1 << 6) | (1<<4) | 0x02; // MISO FUNC 2 pull inactive
LPC_SCU->SFSPF_7 = (1<<4) | 0x02; // MOSI FUNC 2 pull inactive
I have set my spi bus up like:
Code: Select all
const SPIConfig spi1_config = {
NULL,
7,
19,
CR0_DSS8BIT | CR0_FRFSPI | CR0_CPOL | CR0_CPHA,
1000000
} ;
And try to write to SPIbus as following:
Code: Select all
spiAcquireBus(&SPID2);
spiStart(&SPID2,&spi1_config);
chThdSleepMilliseconds(100);
spiSelect (&SPID2);
spiSend (&SPID2, sizeof(uint16_t), &address) ;
spiUnselect (&SPID2);
spiReleaseBus(&SPID2);
In the mcuconf I have enable the SSP and enabled the set SSP clock variable to true, clock source to 0x01 (IRC default).
In halconf.h have set use SPI to true as well.
Can anyone point me in the right direction?