Other Parts Discussed in Thread: CONTROLSUITE, MOTORWARE, TMDSCNCD28069ISO
I am using TMDSCNCD28069MISO controlCARD.
I modify those sample code (echoback/loopback in controlSUITE).
When I use the loopback function in my code, RX and TX work fine.
When I close loopback function, I can transmit data from DSP to PC, but i am unable to receive anything from PC. My code halt this line
while(SCI_getRxFifoStatus(obj4->sciHandle[0]) != 256) { }. The ReceivedChar variable value also 0.
I can't figure out what I am doing wrong.
Please help. Thanks a lot.
Below is my code.
GIPO setting:
// GPIO28
GPIO_setPullup(obj->gpioHandle, GPIO_Number_28, GPIO_Pullup_Enable);
GPIO_setQualification(obj->gpioHandle, GPIO_Number_28); //GPIO_Qual_ASync
GPIO_setMode(obj->gpioHandle,GPIO_Number_28,GPIO_28_Mode_SCIRXDA);
// GPIO29
GPIO_setPullup(obj->gpioHandle, GPIO_Number_29, GPIO_Pullup_Enable);
GPIO_setMode(obj->gpioHandle,GPIO_Number_29,GPIO_29_Mode_SCITXDA);
SCI setting:
void HAL_setupScis(HAL_Handle handle)
{
HAL_Obj *obj = (HAL_Obj *)handle;
SCI_resetChannels(obj->sciHandle[0]);
SCI_resetTxFifo(obj->sciHandle[0]);
SCI_enableTxFifoEnh(obj->sciHandle[0]);
SCI_clearTxFifoInt(obj->sciHandle[0]);
SCI_enableRxFifo(obj->sciHandle[0]);
SCI_clearRxFifoInt(obj->sciHandle[0]);
SCI_setRxFifoIntLevel(obj->sciHandle[0],SCI_FifoLevel_4_Words);
SCI_setCharLength(obj->sciHandle[0],SCI_CharLength_8_Bits);
SCI_enableTx(obj->sciHandle[0]);
SCI_enableRx(obj->sciHandle[0]);
SCI_setBaudRate(obj->sciHandle[0],SCI_BaudRate_230400_Baud);
SCI_setPriority(obj->sciHandle[0],SCI_Priority_FreeRun);
SCI_enable(obj->sciHandle[0]);
SCI_enableTx(obj->sciHandle[0]);
SCI_enableRx(obj->sciHandle[0]);
}
main fuction:
for(;;)
{
if(a==1)
{
scia_xmit(SendChar);
HAL_Obj *obj4 = (HAL_Obj *)halHandle;
while(SCI_getRxFifoStatus(obj4->sciHandle[0]) != 256) { } // wait for RRDY/RXFFST =1 for 1 data available in FIFO
//Check received character
ReceivedChar = SCI_read(obj4->sciHandle[0]);
// Move to the next character and repeat the test
SendChar=SendChar+1;
//Limit the character to 8-bits
SendChar &= 0x00FF;
}
} // end of for(;;) loop