I am using gcc to develop firmware for a LPC43xx chip. I need to use the SSP1 peripheral to read a temperature from a MAX31855 thermocouple converter.
Basically I need to:
- Pull the CS line down
- Wait and read the output from the MAX31855
I have successfully programmed the chip to use the SSP0 channel, however when I try to use the SSP1 channel no clock is generated in the pin PF_4.
If I write any value to the DR register from the SSP1 it is written to the MOSI pin (P1_4), however no clock is generated.
Here's my configuration:
LPC_CGU->BASE_CLK[CLK_BASE_SSP1] = (1 << 11) | (CLKIN_MAINPLL << 24); //enable SSP1 clock
LPC_SCU->SPFP1_4 = 0xF5; //set P1_4 as function 5 (SSP1_MOSI), EPD=0, EPUN=1,EZI=1,ZIF=1, EHS = 1
LPC_SCU->SPFP1_3 = 0xF5; //set P1_3 as function 5 (SSP1_MISO), EPD=0, EPUN=1,EZI=1,ZIF=1, EHS = 1
LPC_SCU->SPFPF_4 = 0xF0; //set PF_4 as function 0 (SSP1_CLK), EPD=0, EPUN=1,EZI=1,ZIF=1, EHS = 1
LPC_SSP1>CR0 = 0x650F; //SPI Mode, 16bit, SPOL=0, CPHA=0, SCR = 0x65
LPC_SSP1>CR1 = 0; //Master Mode
LPC_SSP1>CPSR = 2; // prescaler
LPC_SSP1>CR1 |= (1<<1); //Enable SSP1
After running this code, if I write a value to the LPC_SSP1->DR register I can see the output in MOSI pin, however no clock is generated. Similar config in the SSP0 works. Any help?