MC9S08DZ60 PortD general I/O and TPM

取消
显示结果 
显示  仅  | 搜索替代 
您的意思是: 

MC9S08DZ60 PortD general I/O and TPM

4,208 次查看
EtherJones
Contributor II
Can I use Pin 41 for a discrete output if I am using Pin TPM1CH4 to generate edge-triggered PWM on PIN 40?
 
In other words, if I need to use the TPM1 on-board peripheral, does that prevent me from using the unused channels of TPM1 as discrete outputs (and inputs) ?
 
The data sheet is not very clear on this point.
 
Thank you.
 
 
标签 (1)
0 项奖励
9 回复数

920 次查看
peg
Senior Contributor IV
Hi,
Don't know your exact chip, but the normal case is that unused channels are available for use as GPIO.
 
Regards
David
 
0 项奖励

920 次查看
EtherJones
Contributor II
David wrote:
 
Don't know your exact chip, but the normal case is that unused channels are available for use as GPIO.
 
Can someone confirm this?  The data sheet is unclear on this point:
 
"The peripheral modules have priority over the general-purpose I/O functions so that when a peripheral is enabled, the I/O functions associated with the shared pins are disabled" 
 
    -- Chaper 6, Page 83, MC9S08DZ60 Data Sheet Rev 1 Draft E 6/2006
 
The above sounds like all the peripheral's shared pins have priority, not just the ones the user happens to be using.
 
 
 
 
0 项奖励

920 次查看
peg
Senior Contributor IV
Ok, this from GB manual:
 

Chapter 10 Timer/PWM (TPM) Module

10.4 Pin Descriptions

10.4.2 TPMxCHn — TPMx Channel n I/O Pins

Each TPM channel is associated with an I/O pin on the MCU. The function of this pin depends on the configuration of the channel. In some cases, no pin function is needed so the pin reverts to being controlled by general-purpose I/O controls. When a timer has control of a port pin, the port data and data direction registers do not affect the related pin(s). See the Pins and Connections chapter for additional information about shared pin functions.

perhaps you can look in the similar section of your manual for the same info

 

Regards

David

0 项奖励

920 次查看
EtherJones
Contributor II
 
<<In some cases, no pin function is needed so the pin reverts to being controlled by general-purpose I/O controls>>
 
Yes, that same sentence appears in the data sheet for the MC9S08DZ60 in Chapter 16 section 16.2.2, but my question is this:   Exactly which register, and bit, do I write to, to tell the controller that "no pin function is needed" for this particular pin, even though I am using other channels of the TPM?   I am probably staring right at it and not seeing it.
 
Have you actually done this with the GB, so you're sure it can be done?
 
 
0 项奖励

920 次查看
peg
Senior Contributor IV
Hi Ether,
 
Yes I have, see the description for the bits ELSnB:ELSnA in the TPMxCnSC register.
 
Regards
David
0 项奖励

920 次查看
EtherJones
Contributor II
 
<<Yes I have, see the description for the bits ELSnB:ELSnA in the TPMxCnSC register>>
 
Bingo!  Thank you, sir.   I don't know how I missed that.   I even had the first half of the sentence highlighted.  I guess I have to stop reading these documents at 3 in the morning.
 
 
0 项奖励

920 次查看
Geezer
Contributor I
David is a preety smart dude, I'm ok too at times. We did not contradict each other. You and only you broke the tie... cause it isn't 3 AM yet. :smileyhappy:

As far as what I "seemed" to be saying? No. Programming TIM1 does not automatically grab all the associated channel i/o pins for its amusement. Each of these remains general until you explicitly define them, one at a time.

Al
0 项奖励

920 次查看
Geezer
Contributor I
On power up most pins are general I/O and remain so, you just set the direction, perhaps pullups, perhaps the data (if output.)

If you SPECIFICALLY ENABLE a function (for example SERIAL or IIC) then that module USURPS these pins, flips them as it requires, and they are no longer general I/O. Enabling a function block requires an EXPLICT setting of a bit or two in its control register.

Al
0 项奖励

920 次查看
EtherJones
Contributor II
 
Hi Geezer,
 
My question is this:  If I need to use only  one of TPM1's 6 channels to generate PWM output, does that mean that all the remaining 5 (shared) pins assigned to the other TPM1 channels must also be used as TPM1 pins, and cannot be used as GPIO?
 
If I read your post correctly, you seem to be saying "Yes, if you enable the TPM1 on-board peripheral, then all the pins assigned to that peripheral behave as TPM1 pins, and you cannot use them for GPIO".     Did I understand your post correctly?
 
If so, your answer is exactly the opposite of David's earlier post.
 
Can someone please break the tie?
 

 
0 项奖励