- Fri Nov 22, 2019 7:30 pm
#209919
Hello,
I am evaluating the Ambiq Apollo3 MCU for potential future projects but a large part of our requirements centers around PWM performance. I have been pouring over the SDK and manual and have some code working to generate PWM on pin 18 pad 26, timer 0, Segment B and AUX output. B0OUT2 as per the datasheet, FNCSEL:0x02, CFGx:0x02 (basically pin 18 of Thing Plus with Artemis).
I am observing a few strange occurrences.
1. the PERIOD written to the register according to am_hal_ctimer_aux_period_set(). I can read back the PERIOD register CMPRAUXB0>>16 (or CMPRB3) and it is reads back as 0xFFF or 12bit (4096 steps). But the counter counts until 16bit (65536 steps) so as I step through the 4096 steps of my 12bit (CMPRB2) there is along period between the pulses because the counter is NOT resetting at match to CMPRAUXB0>>16 (or CMPRB3).
2. Randomly the PWM inverts so the short HIGH DUTY becomes a short LOW DUTY and nothing is changing other than updating CMPRB2 to the new DUTY. It seems to be random as it will go through a few cycles then invert and then hold for a while then invert. It does seem to only invert when in the smaller ranges of DUTY. I have code sweeping the range up and down (increasing then decreasing DUTY (CMPRB2)). I do not know what is causing this since the POL bit is not being touched, I can see glitches of HIGH as the DUTY is decreased with it fully inverting from time to time.
I don't know if anyone else has been experimenting with generating PWM from the timers who could provide some insight.
Thank you for your time.
I am evaluating the Ambiq Apollo3 MCU for potential future projects but a large part of our requirements centers around PWM performance. I have been pouring over the SDK and manual and have some code working to generate PWM on pin 18 pad 26, timer 0, Segment B and AUX output. B0OUT2 as per the datasheet, FNCSEL:0x02, CFGx:0x02 (basically pin 18 of Thing Plus with Artemis).
I am observing a few strange occurrences.
1. the PERIOD written to the register according to am_hal_ctimer_aux_period_set(). I can read back the PERIOD register CMPRAUXB0>>16 (or CMPRB3) and it is reads back as 0xFFF or 12bit (4096 steps). But the counter counts until 16bit (65536 steps) so as I step through the 4096 steps of my 12bit (CMPRB2) there is along period between the pulses because the counter is NOT resetting at match to CMPRAUXB0>>16 (or CMPRB3).
2. Randomly the PWM inverts so the short HIGH DUTY becomes a short LOW DUTY and nothing is changing other than updating CMPRB2 to the new DUTY. It seems to be random as it will go through a few cycles then invert and then hold for a while then invert. It does seem to only invert when in the smaller ranges of DUTY. I have code sweeping the range up and down (increasing then decreasing DUTY (CMPRB2)). I do not know what is causing this since the POL bit is not being touched, I can see glitches of HIGH as the DUTY is decreased with it fully inverting from time to time.
I don't know if anyone else has been experimenting with generating PWM from the timers who could provide some insight.
Thank you for your time.