Bugreport: LPCOpen 2.15 for LPC824. SPI port Switch matrix clock is not enabled before setup.

Discussion created by lpcware Employee on Jun 15, 2016
Latest reply on Jun 15, 2016 by lpcware
Content originally posted in LPCWare by larsen on Sat May 30 16:53:11 MST 2015
There is a bug in the example project periph_spi in the file named spi.c when compiled for BOARD_NXP_LPCXPRESSO_824.

In lines 101 to 104 the switch matrix (SWM) is programmed, but the SWM clock is not switched on before setting the matrix. This effectively renders the commands non functional and the example loopback test code fails at the final buffer test.

To repair, simply enable the SWM clock, before writing to the SWM (and off again afterwards to save power).This could look like this:

#elif defined(BOARD_NXP_LPCXPRESSO_824)
Chip_Clock_EnablePeriphClock(SYSCTL_CLOCK_SWM);//<----- add this line to enable SWM clock
Chip_SWM_MovablePinAssign(SWM_SPI1_SSEL0_IO, 15);
Chip_SWM_MovablePinAssign(SWM_SPI1_SCK_IO, 24);
Chip_SWM_MovablePinAssign(SWM_SPI1_MISO_IO, 25);
Chip_SWM_MovablePinAssign(SWM_SPI1_MOSI_IO, 26);
Chip_Clock_DisablePeriphClock(SYSCTL_CLOCK_SWM);//<----- add this line to save power

Please update the distribution code.