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: Can't write AGPIOCTRLA register successfully

Part Number: TMS320F280039C
Other Parts Discussed in Thread: SYSCONFIG

Tool/software:

Hi Champ,

My customer use 80pin version F280039C. Want to use AGPIO pin (Pin33 and P34) as ADC input ( B5 and B11).

We called below function to enable analog mode, but find we can't write AGPIOCTRLA register to 1 successfully. 

GPIO_setAnalogMode(21, GPIO_ANALOG_ENABLED);
GPIO_setAnalogMode(20, GPIO_ANALOG_ENABLED);

Could you please comments on possible reason? Not sure if we need add extra code to make is successful? Or is there any order requirement when calling this function among the initialization related code?

BR,

Fengyu

  • Hello Fengyu,

    Using SysConfig, the code generated to PinMux GPIO 20 to ADC B5 properly is as follows:

    // Analog PinMux for B5, GPIO20
    GPIO_setPinConfig(GPIO_20_GPIO20);
    // AGPIO -> Analog mode selected
    GPIO_setAnalogMode(20, GPIO_ANALOG_ENABLED);

    Try adding the GPIO_setPinConfig() line and see if that fixes the configuration. Note that you will not be able to read the register in CCS properly. The AGPIOCTRLA register is almost entirely reserved, so readback is not possible. Please verify correct configuration with ADC read out values, instead of register value changes.

    Best,

    Ryan

  • Hi Ryan,

    Thanks for your support. 

    Try adding the GPIO_setPinConfig() line and see if that fixes the configuration.

    1. We have tried to add this, but it doesn't work.

    Note that you will not be able to read the register in CCS properly. The AGPIOCTRLA register is almost entirely reserved, so readback is not possible.

    2. For reading AGPIOCTRLA register, I refer to below link to get the value. Is it the right way to get the value? 

    https://e2e.ti.com/support/microcontrollers/c2000-microcontrollers-group/c2000/f/c2000-microcontrollers-forum/1105041/f280039-can-not-see-the-agpioctrla-register?tisearch=e2e-sitesearch&keymatch=f280039%20gpio20#

    BR,

    Fengyu

  • Fengyu,

    2. For reading AGPIOCTRLA register, I refer to below link to get the value. Is it the right way to get the value?

    Thank you for the reference to this post. For whatever reason, I was unable to find it earlier. After making the modification, I was able to read the AGPIOCTRLA register, and could verify that the GPIO_setAnalogMode() function works as expected on my LaunchPad.

    If you are not already in a fresh project, I would try opening an empty DriverLib project and running GPIO_setAnalogMode(21, GPIO_ANALOG_ENABLED) right before the idle loop. If the code is operating in a previously worked in project, there may be some modifications made/code running that prevents this from behaving properly.

    Additionally, try running the code on a different F280039C, to eliminate the possibility that this problem is inherent to the single device you're working with currently.

    Best,

    Ryan