Part Number: TMS320F28335
Other Parts Discussed in Thread: SN65HVD230, CONTROLSUITE
Tool/software: Code Composer Studio
Hello all,
I am using the CAN module of F28335 experimenter kit. Basically I am using ADC to get the sensor data and transmitting this data over CAN. I trying to perform this in a continuous forever loop. I am using SN65HVD230 CAN transceivers. I also displaying the sensor data onto Labview using serial communication. Hence, my code consists of serial, ADC, and CAN.
But the problem here is I am not able to continuously transmit the sensor data over CAN. The data is transmitted only once. After that any changes in sensor output does not reflect onto CAN transmission. Although I am able to see the continuous real time data onto Labview.
I am hereby attaching a part of my code for continuous transmission. Please suggest the required changes to be done.
for(;;)
{
for (i=0; i<AVG; i++)
{
while (AdcRegs.ADCST.bit.INT_SEQ1== 0) {} // Wait for interrupt
AdcRegs.ADCST.bit.INT_SEQ1_CLR = 1;
SampleTable[i] =((AdcRegs.ADCRESULT0>>4));
val = SampleTable[i];
f = val * 7.32600732e-4;
g = f * 33.898305084;
float n = g;
ftoa(n, res, 4);
float m = val;
ftoa(m, res1, 4);
float o = 24.528;
ftoa(o, res2, 4);
msg = res;
scia_msg(msg);
//while(SciaRegs.SCIFFRX.bit.RXFFST !=1) { } // wait for XRDY =1 for empty state
// Get character
// ReceivedChar[50] = SciaRegs.SCIRXBUF.all;
ECanaMboxes.MBOX25.MDL.all = g;
ECanaMboxes.MBOX25.MDH.all = f;
ECanaShadow.CANTRS.all = 0;
ECanaShadow.CANTRS.bit.TRS25 = 1; // Set TRS for mailbox under test
ECanaRegs.CANTRS.all = ECanaShadow.CANTRS.all;
do
{
ECanaShadow.CANTA.all = ECanaRegs.CANTA.all;
} while(ECanaShadow.CANTA.bit.TA25 == 0 ); // Wait for TA5 bit to be set..
ECanaShadow.CANTA.all = 0;
ECanaShadow.CANTA.bit.TA25 = 1; // Clear TA5
ECanaRegs.CANTA.all = ECanaShadow.CANTA.all;
// loopcount ++;
}
}
}
PS. ftoa is the float to string conversion function which is required for serial communication.