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.

CCS/TMS320F28069: First event ECAP lost

Part Number: TMS320F28069


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.

  • Carlos,

    Carlos Miguel Espinar said:
    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?

    You will not see the first rising edge. But, In this case, I wouldn't say the edge is "lost" so much as it was intentionally ignored. The capture module is designed to be not only edge sensitive but to detect rising or falling edges, you have told it "I want the first rising edge", so its waiting for the first rising edge.

    Carlos Miguel Espinar said:
    To summarise up, is there any solution for avoiding this issue?

    The workaround you suggested should work. Unless I am misunderstanding you you do not need to duplicate the CEVTx events. You should just reconfigure CAPxPOL depending on what you read in the GPIO register.

    other options:

      • You could also simply ignore the first first pulse
      • You could ignore the first pulse if a GPIO read <> 0
      • You could verify if this first cycle error has an effect on your system. Being that this is only a setup issue it should only happen once and may be negligible to your system.


    Regards,
    Cody