MATLAB: How to enable the MCU’s internal pullup/pulldown resistors at Embedded Coder Support Package for Texas Instruments C2000 Processors

Developers Kit for Texas Instruments DSPembedded coder support package for texas instruments c2000 processorssimulinktexas instruments

Dear friends,
I am working in a prototype with the F28379D development board, with the Embedded Coder Support Package for Texas Instruments C2000 Processors tool, and enjoying it very much. But, I have a question. How can I enable the internal pullup/pulldown resistors at the MCU's GPIOs that are defined as Digital Inputs?
Thanks,
Gabriel

Best Answer

HI,
If you can try the following:
Please use the "System Initialize" block found under "Simulink coder->Custom Code" library blocks and add the following lines that will execute during the system Initialization.
Under "System Initialize Function Execution Code" section:
EALLOW; GpioCtrlRegs.GPAPUD.bit.GPIO16 = 0; /* To Enable the Pull - Up for GPIO16
EDIS;
The below extract is from controller manual:
(Optional) Enable internal pullup resistors "To enable or disable the pullup resistors, write to the appropriate bits in the GPIO pullup disable registers (GPyPUD). All pullups are disabled by default. pullups can be used to keep input pins in a known state when there is no external signal driving them"
Regards,
Venkatesh C