Content originally posted in LPCWare by manoS on Thu Mar 10 02:01:52 MST 2016 Hello,
I am using SSP1 in SPI mode to communicate with ADC. LPC1857 is in master mode. I need to send 0xFF 15 times to perform software reset on connected slave. CPOL=0;CPHA=0 (as mentioned in ADC data sheet). SPI Clock = 2MHz.
uint8_t uccount =0; //To check no. of bytes sent
uint8_t *;ucfTx_Buf;//This points to array containing 0xFF 15 times
while (uccount != 16)
{
ADC_SSP_Select();//SSEL pulled low delebrately b4 every transmission
if (uccount == 0)
{
SSP_SendData((LPC_SSPn_Type*)ADC_SSP,0xFF);
}
else
{
if (ADC_SSP->SR & SSP_SR_TNF)
{
SSP_SendData((LPC_SSPn_Type*)ADC_SSP,*ucTx_Buf);
ucfTx_Buf++;
count++;
}
}
if (( ADC_SSP -> RIS) & SSP_RIS_ROR)//It never goes into this condition
{
lpc_printf("ROR=%x\r\n",ADC_SSP->RIS );
}
if (( USED_SSP_CS55XX -> RIS) & SSP_IMSC_RT)//It never goes into this condition
{
lpc_printf("RT=%x\r\n",USED_SSP_CS55XX->RIS );
}
while(ADC_SSP->SR & SSP_SR_RNE
{
lpc_printf("R=0x%x\r\n",SSP_ReceiveData((LPC_SSPn_Type*)ADC_SSP));
}
}
For this code, when I see on hyper terminal it shows that all the 15 bytes are successfully sent. But when seen on digital oscilloscope it shows only 10 bytes being sent after which SSEL line goes high again.
Can anyone please help me find what be the possible reason for not sending rest of the bytes on actual lines when on hyper terminal it shows that all data has been sent.