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.

TMS320F280039C: AIO Pins Reading Backwards

Part Number: TMS320F280039C


Hey, 

I am using AIOs here:

#define AIO230_TRZC 230
#define AIO253_STZC 253
#define AIO247_RSZC 247

All I do to set them up is this: 

    // AIO230 -> Phase TR zero cross, 0 = zero cross
    GPIO_setPinConfig(GPIO_230_GPIO230);
    GPIO_setAnalogMode(AIO230_TRZC, GPIO_ANALOG_DISABLED);
    GPIO_setQualificationMode(AIO230_TRZC, GPIO_QUAL_SYNC);

    // AIO253 -> Phase ST zero cross, 0 = zero cross
    GPIO_setPinConfig(GPIO_253_GPIO253);
    GPIO_setAnalogMode(AIO253_STZC, GPIO_ANALOG_DISABLED);
    GPIO_setQualificationMode(AIO253_STZC, GPIO_QUAL_SYNC);

    // AIO247 -> Phase RS zero cross, 0 = zero cross
    GPIO_setPinConfig(GPIO_247_GPIO247);
    GPIO_setAnalogMode(AIO247_RSZC, GPIO_ANALOG_DISABLED);
    GPIO_setQualificationMode(AIO247_RSZC, GPIO_QUAL_SYNC);

However, the pins read opposite of what they really are. When voltage is high, the software reads the pin as 0. When voltage is low, the software reads the pin as 1. Did I miss something in the setup? 

I am using the function GPIO_readPin() to read the value of the AIO. Is this ok? 

  • Hi,

    Can you check the GPHINV register values? If these values are 1, then the inputs get inverted.

    Regards,

    Vince

  • Thanks for the reply! This actually was not an issue at all though. I was confused. I was looking at AIOs to control ramping a DC link capacitor bank with SCR analog front end and it turned out that I swapped A / B compare values on the PWM controllers for the SCRs. This made it seem like one of the GPIOs for when the AC lines cross zero was reading backwards because I more or less swapped 2 phases. 

    I ended up driving a GPIO for an LED and plotting it to the scope to match what the software was reading on the AIO pins and this showed me that the AIOs were reading correctly. 

    Thanks for the help!