Content originally posted in LPCWare by John@MPL on Sat Feb 08 10:36:58 MST 2014
Re:- LPC11A14 33 pin.
I have set up the Demo code for using loopback and works OK if I increment say dest_addr[x] an error occures.
I have switched to TX_RX_ONLY = 1 and USE_CS = 1. and using SSP_NUM = 1
In SSP_Init I have set LPC_SSP1->CR0 = 0x070f; // 16 bit transfer and changed all 8bit refences to 16bit
I can send data to a DAC OK but cannot receive from SPI device.
I can see the CS_ toggle and load data out to the MISO Input.
In MAIN my code is:-
GPIOSetBitValue( PORT0, 4, 1 ); // Enable Gate to SPI device
for ( x = 0; x < 100; x++ );// Allow to settle
SSP_Receive( SSP_NUM, (uint16_t *)dest_addr16, 1 ); // Set one word into buffer
for ( x = 0; x < 100; x++ );// Short delay
GPIOSetBitValue( PORT0, 4, 0 ); // Disable Gate to SPI Device
src_addr16[0] = dest_addr16[0]; // Put received data into src_addr16 to send to DAC
// if I do scr_addr16[0] = 0x1800; // DAC and has correct value with a range from 0x0000 to 0x3fff
GPIOSetBitValue( PORT0, 26, 1 ); // Enable DAC Output
SSP_Send( SSP_NUM, (uint16_t *)src_addr16, 1);
GPIOSetBitValue( PORT0, 26, 0 ); // Disable DAC Output
I do not appear to get the correct value from dest_addr16[0]
The SSP_Send and Receives are as is.
Any help would be appreciated.
regards John W.