I'm using the TMS570ls20216spge and I am outputting a 10 us pulse and trying to read an echo pulse using the HET12 and HET14 respectively. I used RTI to generate the 10 us pulse and have edge interrupts for edge 0 for rising edge and edge 1 for falling edge. The echo is from a sonar range finder srf04. I am able to read how many times each edge occurs using edgeGetCounter but the interrupt only fires one time and records the time stamp. I tried to reset the edge counter after entering the interrupt but still only ran once but the edge counter is counting continuously as it should. Also the timestamp returns a loop count. How do you convert the count to a specific time? Here is what I have done so far.
gioSetDirection(hetPORT, 0x00001FFF);
// Enable RTI Compare 0 interrupt notification /
rtiEnableNotification(rtiNOTIFICATION_COMPARE0);
edgeEnableNotification(edge0);
edgeEnableNotification(edge1);
_enable_FIQ();
// Start RTI Counter Block 0 /
rtiStartCounter(rtiCOUNTER_BLOCK0);
void edgeEnableNotification(unsigned edge)
{
unsigned int time, time2, reset = 0;
switch(edge)
{
case 0:
{
time = hetGetTimestamp();
break;
}
case 1:
{
time2 = hetGetTimestamp();
reset = 3;
break;
}
}
if(reset == 3)
{
edgeResetCounter(edge0);
edgeResetCounter(edge1);
}
final = time2 - time;
}