how to initialize PWM2 on pin DO0?

キャンセル
次の結果を表示 
表示  限定  | 次の代わりに検索 
もしかして: 

how to initialize PWM2 on pin DO0?

1,649件の閲覧回数
13560436802
Contributor II

Hi, i use the pin DO0 to generate PWM,my code is below,but it does not work.

--project: JN-AN_1217-Zigbee-3-0-Base-Device

--ROUTER

PUBLIC void tim2_PWMInit(void)
{
vAHI_TimerSetLocation(E_AHI_TIMER_2,FALSE,TRUE); // PWM2
vAHI_TimerFineGrainDIOControl(1<<4);
vAHI_TimerEnable(E_AHI_TIMER_2,10,FALSE,FALSE,TRUE);
vAHI_TimerConfigureOutputs(E_AHI_TIMER_2,TRUE,TRUE);
vAHI_TimerClockSelect(E_AHI_TIMER_2, FALSE, TRUE);

vAHI_TimerStartRepeat(E_AHI_TIMER_2,1000,1000);
}

ラベル(1)
0 件の賞賛
返信
6 返答(返信)

1,453件の閲覧回数
mario_castaneda
NXP TechSupport
NXP TechSupport

Hi Dylan,
Please see the code below, I already tested I am using the DIO8, Did you set the direction of the DO0 pin?.

              vAHI_DioSetDirection(0, (1<<8));

              vAHI_DioSetOutput(0,(1<< 8));

              vAHI_TimerFineGrainDIOControl(0x9F);//Timer 3 and 4 enable

              vAHI_TimerSetLocation(E_AHI_TIMER_4,TRUE,FALSE);

              vAHI_TimerEnable(E_AHI_TIMER_4, 4,FALSE, FALSE, TRUE);

              vAHI_TimerClockSelect(E_AHI_TIMER_4,FALSE, TRUE);

              vAHI_TimerConfigureOutputs(E_AHI_TIMER_4,FALSE ,TRUE);

              vAHI_TimerStartRepeat(E_AHI_TIMER_4,125 ,255);
// PWM_PERIOD = (1000000/1000)

Regards,

Mario

0 件の賞賛
返信

1,453件の閲覧回数
13560436802
Contributor II

thank you!

0 件の賞賛
返信

1,453件の閲覧回数
13560436802
Contributor II

Hi Mario, i have anther problem,

--project: JN-AN_1217-Zigbee-3-0-Base-Device

--ROUTER

1.If DO2 connect to GND, the system fails to start;

2. If i take out the "R1",the system will start normal;

pastedImage_1.png

0 件の賞賛
返信

1,453件の閲覧回数
mario_castaneda
NXP TechSupport
NXP TechSupport

Hi Dylan,

The DO0 pin is only output purpose. I am not sure if you are programming but it should be floating.

pastedImage_1.png

Regards,

Mario

0 件の賞賛
返信

1,453件の閲覧回数
13560436802
Contributor II

Hi mario, the application schematic diagram below, the mark "ZB_IRTX"connect to the DO0;

SO the DO0 generate PWM to drive the LED; 

problem:the system can't start. But if take out the "R20",the system can start normal;

By the way, i make a test, if  i connect the DO0 to the GND,the system also can't start;

pastedImage_6.png

0 件の賞賛
返信

1,453件の閲覧回数
mario_castaneda
NXP TechSupport
NXP TechSupport

Hi Dylan,

Please re-recalculate the resistance value that is connected to the DO0.

I suggest less value.

Regards,

Mario

0 件の賞賛
返信