PWM output signal not working when multilink programmer not connected

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

PWM output signal not working when multilink programmer not connected

368 Views
fabrizioimpinna
Contributor II

Dears,

I am developing an application code on a MC9S12ZVL microcontroller.

 

I have a problem using the PWM2 output signal connested to PT0 port.

The PWM2 output works properly when I download the code on the micro and I keep the Multilink programmer connected (I use that PWM suìignal to drive a LED changing the light intensity and everything works in the right way). If I disconnect the multilink, switch off and then on again the micro, no PWM signal goes out from the PT0 port (PWM2 output does not work).

I use other PWM signal to drive other LEDs and they still work properly even if the programmer is not connected and the code starts from flash.

For the application I made a patch on the board using an other PWM (I used PWM7 instead of PWM2) but I would like to understand the problem for the future.

 

I guess the key point could be in the initialization procedure that the multilink programmer makes when connected.

Could you help me in fixing this problem?

 

Thanks in advance

 

Fabrizio

Labels (1)
0 Kudos
1 Reply

274 Views
RadekS
NXP Employee
NXP Employee

Hi Fabrizio,

When MCU works in special mode and not in normal mode, typical issue is some writes to write-once registers. In special mode, number of writes into these registers are not limited, but you could write these register only once in normal mode.

So, I guess that your code modify MODRR1 register (route PWM2 to PT0) more than once.

So, be careful especially on read/modify/write access to these registers. For example:

MODRR1_PWM0=1; //route PWM0 to PT1

MODRR1_PWM2=1; //route PWM0 to PT0

This second write into MODRR1 register will be ignored in normal mode due to write-once limitation and PWM2 will stay routed to default pin PP2.

Note: If you use PE for generating code, PE_low_level_init() function may also contain initialization of these registers.

Writes to PWM registers itself are not limited.

Second idea:

Could you please check connection of TEST pin? TEST pin must be connected to GND. Otherwise you could start MCU into test mode and some of pins (typically PT0, PT1) will have different functionality.


I hope it helps you.

Have a great day,
RadekS

-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------

0 Kudos