MATLAB Answers

GPxPUD register values in C2000 F28035 c28x_LedBlink_ert Simulink Example

24 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

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.
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!