Tool/software: Code Composer Studio
Hi,
I am using the eCAP Peripheral Module with a TMS320F28069 microcontroller for reading the Hall Sensor input signals from a PMSM. In this project, I have configured the three inputs in the same way for recording the consequent events. I use the GPIO24 pin as the ECAP1 function, the GPIO25 pin as the ECAP2 function and the GPIO26 pin as the ECAP3 function. For all of them, in this project the CEVT1 event is generated when a rising edge is received and the CEVT2 event is generated when a falling edge is received.
What does it happen if the first event is not a rising edge? We have observed that this event is missed. As you could analyse the Hall Sensor signals will divide an entire electrical turn in six sectors. If the motor will spin in one direction, there are three possible sectors where the next edge would be a falling edge and if the motor will spin in the other one, the others three sectors would generate a falling edge. Then, for these channels where the first event is a falling edge, it will be lost?
I don’t have a clear conclusion from the datasheet but I suppose that if the first event is not the same as it has been configured in the CAP1POL register this event will not be registered, although this event has the same polarity as the CAP2POL. In a general way, I process these events in an interrupt caused by CEVT1 and CEVT2 events. But until a certain value of the electrical frequency, the GPIOs inputs are also evaluated during the ADC interrupt at 20 kHz, doing an equivalent task.
To summarise up, is there any solution for avoiding this issue? From other posts I have read that one solution could be reading the GPIOs states before the ECAP peripheral configuration. If the GPIOs status are at low level, the first event ought to be configured as a rising edge and if the GPIOs status are a high level, the first event ought to be configured as a falling edge. Here, I see the problem during the interrupt execution because I have to duplicate the CEVT1 and CEVT2 events according if these are configured as a rising or falling edge events.
Is there any possibility to access to the inner counter Mod4? In this case, we could modify its value according to the GPIOs status.
Best regards.