I need to implement a function that returns the time since poweron/reset/init in microseconds.
Later the client code will use this function as timebase to implement wait and simple measurement of time duration.
Code Composer 6.1
HAL Code Generator 04.05.1
TMS570 HDK Board
HET provides API edgeGetCounter : Get current edge counter value.
HET provides API hetGetTimestamp : Returns loop count based timestamp.
I did in HAL-Code Generator:
Driver Enable : Enable GIO Driver
Driver Enable : HET1 Driver
PINMUX Enable HET1
PINMUX Enable GIOA
Note: No RTI.
HET1: Loop Time 800 => Actual LR Time 800nsec
HET1: TAB Edge0-7: Edge0 change pin 12 => pin0
HET1: TAB Edge0-7: Edge1 change pin 13 => pin1
HET1: TAB Edge0-7: Edge2 change pin 13 => pin2
Expected:
Application Code (Init):
hetInit();
hetResetTimestamp (hetRAM1);
edgeResetCounter (hetRAM1, 0);
edgeResetCounter (hetRAM1, 1);
edgeResetCounter (hetRAM1, 2);
edgeResetCounter (hetRAM1, 3);
edgeResetCounter (hetRAM1, 4);
edgeResetCounter (hetRAM1, 5);
ts[0] = hetGetTimestamp(hetRAM1);
tse [0] = edgeGetCounter(hetRAM1, 0);
tse [1] = edgeGetCounter(hetRAM1, 1);
tse [2] = edgeGetCounter(hetRAM1, 2);
tse [3] = edgeGetCounter(hetRAM1, 3);
tse [4] = edgeGetCounter(hetRAM1, 4);
tse [5] = edgeGetCounter(hetRAM1, 5);
ts[1] = hetGetTimestamp(hetRAM1);
On target:
The value of timestamp increments more than 1.
The value of edge counter is zero .
The init hangs if SAFETY INIT checks (BIST) are selected.
Expected:
timestamp incremented every 800 nsec (loop value)
Edge: pin0 incremented every 12.5 nsec (80 Mhz Clock)
Edge: pin1 incremented every 25 nsec ()
Edge: pin2 incremented every 50 nsec ()
I am pretty new on TMS570. I do not know if my expectation is correct.
Please confirm.
If I have to write customized HET code then can you please explain why and how.
BTW: If I run with Debugger and stop, does HET increment counters or only executed if CPU runs ?
Thanks,
Martin