How to run PWM on RT1064 EVK ?

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

How to run PWM on RT1064 EVK ?

Jump to solution
2,195 Views
Maciek
Contributor V

Hi,

I've attached simple project that should run PWM2 and PWM4 on RT1064 EVK. Most of the clocks are inactive. Core clock 100MHz. 

PWM2, submodule 3, signal A is connected to the USER_LED on RT1064 EVK and is set to 4 Hz with 50% duty cycle.

The other PWM4, submodule 0, signal A is connected to pin4 on J22 header on EVK and set to 4 kHz with 50% duty cycle - and it is watched on oscilloscope.

With this configuration (as in the project) I'm not able to run any of these PWMs (the diode doesn't blink and there is no waveform on oscilloscope). The timers are started at initialization. 

Can anyone check and tell me what is wrong with this project ? What am I missing from the API ?

Thanks for help

Maciek

0 Kudos
1 Solution
2,148 Views
FelipeGarcia
NXP Employee
NXP Employee

Hi Maciek,

1. Correct.

2. Correct.

Regarding your other question, as you mentioned we do not have a specific space to say how faults are internally connected. Maybe what I can recommend to you is to check our SDK examples to see the PWM initialization and steps needed.

Best regards,

Felipe

View solution in original post

0 Kudos
4 Replies
1,347 Views
Desmond_lim
Contributor III

Hi,

I was having the same problem, however, I still am a bit confused and my code does not work at all too.

Based on the discussion above, I have a few questions and I hope this will make this forum more clearer.

1. The above example only set the XBARA1 for pwm2, what about pwm4. Do we need to have both of them in there?

XBARA_Init(XBARA1);
XBARA_SetSignalsConnection(XBARA1, kXBARA1_InputLogicHigh, kXBARA1_OutputFlexpwm2Fault0);

Ques_1) What about kXBARA1_OutputFlexpwm4Fault0??

Ques_2) In the SDK examples, I also noticed that they are setting the following Faults too. I seriously don't know what are those and should we set them or not? If we need, do we need to set them for pwm4 as well?

XBARA_SetSignalsConnection(XBARA1, kXBARA1_InputLogicHigh, kXBARA1_OutputFlexpwm2Fault1);
XBARA_SetSignalsConnection(XBARA1, kXBARA1_InputLogicHigh, kXBARA1_OutputFlexpwm1234Fault2);
XBARA_SetSignalsConnection(XBARA1, kXBARA1_InputLogicHigh, kXBARA1_OutputFlexpwm1234Fault3);

2. Let's say that I have done the 'XBARA1_Init(XBARA1) routine' for pwm2Fault0 in an instance, later in another instance, I did another 'XBARA1_Init(XBARA1) routine' for pwm4 by changing the parameters of  kXBARA1_OutputFlexpwm2Fault0 to  kXBARA1_OutputFlexpwm4Fault0. Will this cause the system to hang?

Ques_1) Do they need to do in one go or use another XBAR or stop the current running one and start again or anything? Sorry, I cannot find any information on this and I just need your adviser to get my understanding straight for this XBAR thingy. Also please guide me to the right documentations for my understanding.

3. I noticed that your advise is to do the XBAR_Init before setting up the PWM configuration (I also experienced this is true for my case too.) My question would be is this the hardcore rules that this XBAR thingy needs to be done before all the peripheral setup and not after or else it will not work? What is exactly this thing anyway since it is so **bleep** important?

4. Actually, the PWMs I am using is PWM1 (Module 2, Signal A) and PWM3 (Module 1, Signal A & B). Yes 3 PWM signals. I have set up for PWM3 and both A and B signal can output successfully. But, when I add in PWM1 (with separate PWM configuration and XBAR1_Init, all 3 signals got jammed. I am totally bombed, puzzled and frustrated by that. Then came across this forum and try to do a comparison and notice the explanation not complete. Hence, this lengthy letter. Hopefully, you can help me and maybe save someone some troubles reading multiple forum for the sake of using the IC.

Thanks.

0 Kudos
2,175 Views
FelipeGarcia
NXP Employee
NXP Employee

Hi Maciek,

It seems you are missing fault assignation with XBAR. Please add the lines below before calling BOARD_InitBootPeripherals in your code, you will see LED will start working after that.

XBARA_Init(XBARA1);

XBARA_SetSignalsConnection(XBARA1, kXBARA1_InputLogicHigh, kXBARA1_OutputFlexpwm2Fault0);

Hope it helps!

Have a great day,

Felipe

-------------------------------------------------------------------------------

Note:

- If this post answers your question, please click the "Mark Correct" button. Thank you!

- We are following threads for 7 weeks after the last post, later replies are ignored. Please open a new thread and refer to the closed one, if you have a related question at a later point in time. 

------------------------------------------------------------------------------ 

0 Kudos
2,168 Views
Maciek
Contributor V

Hi @FelipeGarcia 

thanks for the clarification. 

Please confirm if my understanding is correct:

1. I assume that PWM_FAULT pins are internal input pins to the PWM peripheral and they are directly connected only to the outputs of the Crossbar Switch (XBAR) peripheral. This way we can only set these pins using XBAR.

2. The line:

XBARA_SetSignalsConnection(XBARA1, kXBARA1_InputLogicHigh, kXBARA1_OutputFlexpwm2Fault0);

actually does not connect the PWM_FAULT pin to any other peripheral signal in RT1064. It simply sets the XBAR output connected to the PWM_FAULT pin to logic HIGH.

 

I have also one question:

1. I didn't find this info (that PWM Fault is connected (only) to output of XBAR) in the PWM section of the User Guide. In the future, in case of other peripherals: what is the best way of finding out how they are internally connected ? For example I'm still not sure if XBAR output is the only sourse for driving PWM_FAULT input signal (maybe there are other 'switches' that connect this input somewhere else...)

Thanks for help

Maciek

0 Kudos
2,149 Views
FelipeGarcia
NXP Employee
NXP Employee

Hi Maciek,

1. Correct.

2. Correct.

Regarding your other question, as you mentioned we do not have a specific space to say how faults are internally connected. Maybe what I can recommend to you is to check our SDK examples to see the PWM initialization and steps needed.

Best regards,

Felipe

0 Kudos