Hi everyone,
I am using one of the PWM channels on my AT91sam7s64 to create a data packet. I wanted to have the channel sit low until I create the packet e.g. bit 1 = short high, long low x 2; bit= 0 short high, long low, long high, short low. Then afte packet is complete go back low.
I'm pretty sure I have set everything up correctly

:wink:
at initialisation I set CPOL = 1, DUTYCYCLE = 0 then enable the channel to make sure the channel sits low.
I enable the interrupt to update the duty cycle in the ISR and wait for the for the ISR to finish (using a flag) before loading my next value in.
Once I'm finished I set the DUTYCYCLE back to 0 and disable the interrupts.
I know i shouldn't be setting the DUTYCYCLE to 0 or to the period length but if I set it to a value in between won't I get a pulse I don't want?? My polarity is toggling which I assume is down to to the DUTYCYCLE = 0 when the interrupt is enabled.
Is there a particular method I should apply to achieve the behaviour I want?
1. initialise PWM (clocks, cpol etc) I enable the channel here....should I enable the channel and/or interrupts here?
2. Packet to be created & sent now. So I enable the interrupt and load values in then disable the interrupt when finished.
I repeat step 2 whenever a packet is to be sent.
am i missing something obvious?
Thanks
swilson