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