This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

TMS320F28069: Switch and if not working in TMS320F28069 code

Part Number: TMS320F28069

I am developing a project based TMS320F28069.   I am facing very strange issue.  In the following code snippet- I am receiving data rxCmdPkt.recvpkt.EpcData = 0x31 from a remote system.  I am able to print the same in  a hyper terminal in the following lines

scia_xmit(0x44);
epcmd=rxCmdPkt.recvpkt.EpcData;
scia_xmit(epcmd);

But the serial print  inside if loop and switch loop are not working

void epccmdProcRRtask(void)
{
// char epcmd;
if(newCmdAvlbl())
{
rxcmd=retrieveCmd();
rxCmdPkt.recvpkt= rxcmd;

// ROM_UARTCharPutNonBlocking(UART0_BASE, rxCmdPkt.recvpkt.EpcData);
scia_xmit(rxCmdPkt.recvpkt.StartByte);
scia_xmit(rxCmdPkt.recvpkt.MsgID);
scia_xmit(rxCmdPkt.recvpkt.EpcData);
scia_xmit(rxCmdPkt.recvpkt.Checksum);
scia_xmit(rxCmdPkt.recvpkt.EndByte1);
scia_xmit(0x44);
epcmd=rxCmdPkt.recvpkt.EpcData;
scia_xmit(epcmd);
if(epcmd == 0x31)
{
scia_xmit(0x45);
XmitMessage(rxCmdPkt.RxMsgArray, 5);
}
// scia_xmit(epcmd);
switch(epcmd)
{
case 0x31:
scia_xmit(0x45);
XmitMessage(rxCmdPkt.RxMsgArray, 5);
// setEpcStsXmitRequest();
break;
case EpcHeaterON:

epcHeatON(rxCmdPkt.recvpkt);
break;
case EpcHeaterOff:
epcHeatOFF(rxCmdPkt.recvpkt);
break;
case EPCForceModeON:
epcForceModeONfn(rxCmdPkt.recvpkt);
break;
case EPCForceModeOFF:
epcForceModeOFFfn(rxCmdPkt.recvpkt);
break;
case EPCTXON:
// ROM_UARTCharPutNonBlocking(UART0_BASE, EPCTXON);
XmitMessage(rxCmdPkt.RxMsgArray, 5);
epcTXON(rxCmdPkt.recvpkt);
break;

}

}

}

The optimizaton is OFF

Could you help

Regards,

Ramesh

  • I further investigated and found that the problem is due to the 16 bit size of Uint8 variables.  From SPI port receives 8 bit and shifts the previously received 8 bit to msb.  When I check the UInt8 variable it actually checks 16 bit and not working.

    Regards,

    Ramesh