MATLAB Answers

GPxPUD register values in C2000 F28035 c28x_LedBlink_ert Simulink Example

13 views (last 30 days)
Alex B
Alex B on 30 Aug 2018
Commented: Alex B on 12 Sep 2018
F28035 simulink example file: "c28x_LedBlink_ert" After the program was loaded, I clicked on the "Open project in Code Composer Studio" in the simulink "Diagnostic Viewer". In the CCS watch window, I was going through the register values and had a few questions:
1) In the CCS watch window for "c28x_LedBlink_ert" "GPAPUD" by default has a value 0x00000FFF (pull up disabled for GPIOs 0 to 11, which are PWMs), similarly "GPBPUD" has a default value of 0x00000300 (pull up disabled for GPIO 40 & 41, again these are PWMs). However I can't seem to find the file that initializes the registers with the mentioned values, the only file initializing the "GPxPUD" register is in fact the "DSP280x_Gpio.c" file which initializes the pull ups using the following two lines:
GpioCtrlRegs.GPAPUD.all = 0x0000; GpioCtrlRegs.GPBPUD.all = 0x0000;
So there has to be another file overwriting these registers, could I be directed to that file/function?
2) The "c28x_LedBlink_ert" toggles the GPIO pins 31 & 34, so that means that those GPIOs should be set as outputs, again looking at the watch window I observe that "GPADIR" has a value of 0x80000000 (i.e. GPIO 31 = output) and "GPBDIR" has a value of 0x00000004 (i.e. GPIO 34 = output), so things are fine. However shouldn't the pull ups be disbaled since these are outputs? Shouldn't "GPAPUD" be 0x80000FFF and "GPBPUD" be 0x00000304?
Thanks in advance


Sign in to comment.

Answers (1)

Antonin on 3 Sep 2018
Hi Alex,
We don't initialize the pull-up registers and the default values after reset are not uniform across the different registers. The value you see for GPAPUD (0x00000FFF) corresponds to the value after reset. Look at Figure 63 of the following document:
Figure 64 shows the GPBPUD and the value 0x00000300 is also the value after reset.
I would agree that once the pin is driven as an output, the pullup is just a waste, though not harmful.
You can initialize the pullup registers using the following custom code block:
We will consider removing pullup for outputs in future releases.
Thanks for your input.


Show 2 older comments
Alex B
Alex B on 5 Sep 2018
Once again, thanks for your reply Antonin.
1) After posting a thread on the TI E2E community, I was given the following response in regard to a file that initializes the register:
"The default register values are handled in hardware not software...It also may be worth saying that they're not configurable."
2) I did a quick test on the current drawn by the controller under the following conditions:
- All GPIOs set as outputs
- All GPIOs set to 0V
- All GPIO mux registers set to 0x00000000
Device Used: F28335 (has more GPIOs - which help in observing a greater difference between the current drawn for the two scenarios)
(a) First, the pull ups were disabled:
The current drawn is 175mA
(b) Next, the pull ups were enabled: possible short circuit path?
The current drawn is 184mA
From the watch windows, one can observe that 88 GPIOs have their pull ups disabled and then enabled. The difference in the current drawn is:
184mA - 175mA = 9000uA
the current increase per GPIO pin = (9000/88)uA ~ 102uA
Based off the F28035 datasheet, that roughly puts us in the ballpark:
The way I connected the current sensor was as follows:
Anyway, let me know your thoughts Antonin, you have been a great help so far.
PS: Are these videos made by you??
Antonin on 6 Sep 2018
Great work, You proved it!
I shared your investigation with the team here, everyone loves it. People also think that you are a great photographer and that we should gift you with a new USB cable to thank you for the work :-)
On a more serious note, TI mentions in the documentation of the F2837x devices that input pins should not be left floating, which probably explains why they enabled the pullup by default on most F28335 pins except the ones that are dedicated to be outputs (i.e. PWM). On new devices, they disabled all pullups by default, which probably prompted them to add the warning.
We will investigate a way to configure the pullup registers in our tools. In addition to allowing the user to set the pullup, we can detect how pins are used to automatically set the pullup.
PS: Yes, these are my videos
Alex B
Alex B on 12 Sep 2018
Thank you Antonin,
The Mathworks forums have been a great place for me to explore and learn new things. Through this post I have had the opportunity to discuss an interesting concept which may also help other learners. To make things easy for others to understand, I added clear pictures and screenshots with what was trying to be achieved. It was a fun exercise :)
I appreciate you sharing the documentation from the F2837x family. I hadn't come across that documentation as my projects use the F28335 and F28035 devices.
I guess that is what I did in the "experimentation" part of this post, not advised by TI though.
Till there is a new release from Mathworks, users may want to do the following (as suggested by Antonin earlier in this post):
Select the block and place it in your simulink project with the following embedded code:
Sanity check: Verify through CCS watch window (GPIOs 31 and 34 have their pull ups disabled)

Sign in to comment.

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by