GPxPUD register values in C2000 F28035 c28x_LedBlink_ert Simulink Example

19 ビュー (過去 30 日間)
Alex B
Alex B 2018 年 8 月 30 日
コメント済み: Alex B 2018 年 9 月 12 日
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

回答 (1 件)

Antonin
Antonin 2018 年 9 月 3 日
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.
Antonin.
  5 件のコメント
Antonin
Antonin 2018 年 9 月 6 日
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.
Thanks,
Antonin.
PS: Yes, these are my videos
Alex B
Alex B 2018 年 9 月 12 日
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)
Thanks

サインインしてコメントする。

製品


リリース

R2018a

Community Treasure Hunt

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

Start Hunting!

Translated by