thanks, things are more devilish than i thought.
i'm getting a flat 0 v on the pin PA1 T2_CH2, i'm actually measuring voltages from PA0 - ADC channel 0.
i've verified that the voltages measured correctly from PA0 (i did that by measuring 3v3), but if i patch PA0 ADC0 - PA1 T2_CH2 i get a flat 0 volt instead.
i actually switch to PA2 (and changing the codes accordingly) but with the same effect observed. i meddled with the gpio ospeeds but the results are same.
the timers are running, i check by interrupting and looking at the timer count, the count is changing.
As each of those pins has multiple afio on the same pin, e.g. PA1 has T2_CH2, T2_CH5, ADC1, RTS2 and the gpio itself on the same pin.
I'm next trying to figure out if 2 of the AFIO has an output enabled on the same pin. that may 'short' the signals from one block e.g. TIM2 to UART2.
But i'd guess shouldn't happen as Serial2 isn't initialised with a begin() statement.
i also found out that i should probably call
Code: Select all
timer_oc_set_mode(TIMER2,TIMER_CH2,TIMER_OC_MODE_PWM_1,TIMER_OC_PE);
the preload enable flag is probably needed. I've since changed to simply calling
Code: Select all
timer_set_mode(TIMER2, TIMER_CH2, TIMER_PWM);
that does the same thing.
i've also adopted the initializations at reset to be simply clock the timers and disable them, setting ARPE
https://github.com/stevstrong/Arduino_S ... 114f14bc95
this mainly to prevent spurious initialization e.g. that both TIM2 and TIM5 are sending output to the same pin.
shouldn't happen, since the timers are not configured and disabled.
it seemed turning on (i.e. clock) blocks that one is not about to use may have unintended consequences, e.g. the afio output from one block e.g. TIM2 short into another block. i've been thinking that if the output isn't enabled it should be high-z, but i'd guess sometimes we'd not be aware that some initialization may have enabled output on the same bus. still debugging the problem, but i'd let leave for now.