Can somebody explain why PORTTD is "dreaded"?

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Can somebody explain why PORTTD is "dreaded"?

1,330 Views
mykepredko
Contributor IV

Hi Folks,

 

I'm working with the MCF52223, trying to get the PWMs working under MQX and I'm trying to figure out some discrepancies I am finding in the manual as well as MQX. 

 

If I look at Table 2.1 in the Reference Manual, it indicates that the GPT3:0/PWM7,5,3,1 map to a GPIO pin as their quaternary function.  Jumping to Figure 12-1, they are listed as being on PORTTD BUT, in the rest of section 12, there is no mention of any registers for TD.  Nor is there any reference to a "PTDPAR" register in table A3, the register list at the end of the RM.  Similarly, when I go through the MQX source code for the gpio device drivers, there is no reference to these GPIOs or PORTTD. 

 

In section 26.1 of the RM there is the Note: "The GPIO module must be configured to enable the peripheral function of the appropriate pins (refer to Chapter 12, "General Purpose I/O Module") prior to configuring the PWM module." which leads me to believe I have to write to the PTDPAR register. 

 

When I look through the forums, I see a comment about PORTTD being "dreaded" but I can't find any other information. 

 

Could somebody please explain what are the issues with PORTTD and whether or not I can use PWM 7, 5, 3, 1 as is, and how do I ensure the Quad Function Pin Assignment Register for PORTTD (PTDPAR - which I can't find any reference of other than the ones cited above) will output a PWM signal as required? 

 

Thanx,

 

myke

Labels (1)
0 Kudos
3 Replies

496 Views
DrSeuss
Contributor I

I do not know why this port might be more "dreaded than any other, but I can account for the fact that it is strange. The availability of this port depends on whether the device has USB. This same die is used for the MCF52221, MCF52223, MCF52110, and MCF52100. The parts that do not have USB (MCF52110, MCF52100) have this port to replace the USB pins. So for the  MCF52221 and MCF52223 the docs should not have this register and for the MCF52110, MCF52100 it should replace the USB pins on these devices

bottom line PORT TD should not be in the MCF52221 and MCF52223 the docs

 

 

Please see attachment for details on where PORT TD is (on non USB parts).

0 Kudos

496 Views
mykepredko
Contributor IV

That makes sense that there would be issues if it is used for USB on some devices and not on others (I wonder if it is "dreaded" when somebody tries to disable the USB functions and use the pins for gpio).

 

Thank you good doctor,

 

myke

0 Kudos

496 Views
mykepredko
Contributor IV

Hey Folks,

 

In my research, trying to figure out how to use PWMs, I found "M52233DEMO_PWM" in the downloads section and in it, the PORTTA registers are used for PWM1,3,5,7.  Looking at Figure 12-1, it looks like PWM1,3,5,7 can be controlled from either PORTTD or PORTTA - is this correct and is this what PORTTD is "dreaded"? 

 

It's a bit confusing: the bit pairs for each pin in the PTAPAR register are being set to 3, which, seems like they should be set to GPIOs.  BUT, when I read table 12-7 in the MCF52223RM, it seems to imply:


PnnPAR[bit] = 0b00 - GPIO Function (in Table 2-1, this is the "Quaternary Function" and would make the most sense to be 0b11)
PnnPAR[bit] = 0b01 - Pin Assumes its Primary Function
PnnPAR[bit] = 0b10 - Pin Assumes its Secondary Function
PnnPAR[bit] = 0b11 - Pin Assumes its Tertiary Function

I just walked through the gpio 'open' function in MQX and this seems to be the case. 

 

Does this seem correct?  The documentation really isn't that clear. 

 

Thanx,

 

myke

0 Kudos