Page 3 of 4

Re: Updated question, How to set PA15 to GPIO Output, and PWM questions...

Posted: Wed Oct 14, 2020 6:08 pm
by stevestrong
Theoretically that would be sufficient.
Make a short sketch only to test PA11 functionality on a bluepill.

Re: Updated question, How to set PA15 to GPIO Output, and PWM questions...

Posted: Wed Oct 14, 2020 6:46 pm
by Mangy_Dog
ummm
back to my generic as I struggled to get my one last maple mini working over usb....
PA11 is working again... randomly........... and PA15 not working again!
Its not enabledebugports function has just stopped doing anything :/

added

its getting stranger and stranger......... Still cant use those jtag pins thast just stopped working for no reason...

But if i build from within sloeber, PA11 doesnt work right... If i build from arduino IDE............ PA11 works.... But i still cant get jtag pins working :/

this is turning incredibly infuriating.

Re: Updated question, How to set PA15 to GPIO Output, and PWM questions...

Posted: Wed Oct 14, 2020 7:50 pm
by Mangy_Dog
Right forgot to uncomment that remap... the other pins are working now...
Got to hotwire PA1 to PB1 and figure out why building in sloeber is foofing up PA11 PWM, when building in arduino ide works............ sighs! Why cant things just work. I already got tons of work to do with the main program :p

Re: Updated question, How to set PA15 to GPIO Output, and PWM questions... Update Page3

Posted: Thu Dec 08, 2022 5:47 pm
by Mangy_Dog
Bit of a bump returning to this problem as its evolved with the new version of this project....

Basically im back at having trouble getting PB5 to run PWM.

I have this code setup in the boards.cpp file.

Code: Select all

extern const stm32_pin_info PIN_MAP[BOARD_NR_GPIO_PINS] = {


        {&gpioa, &timer2, &adc1,  0, 1,    0}, /* PA0 */
        {&gpioa, &timer2, &adc1,  1, 2,    1}, /* PA1 */
        {&gpioa, &timer2, &adc1,  2, 3,    2}, /* PA2 */
        {&gpioa, &timer2, &adc1,  3, 4,    3}, /* PA3 */
        {&gpioa,   NULL, &adc1,  4, 0,    4}, /* PA4 */
        {&gpioa,   NULL, &adc1,  5, 0,    5}, /* PA5 */
        {&gpioa,   NULL, &adc1,  6, 0,    6}, /* PA6 */
        {&gpioa,   NULL, &adc1,  7, 0,    7}, /* PA7 */
        {&gpioa, &timer1, NULL,  8, 1, ADCx}, /* PA8 */	
        {&gpioa, &timer1, NULL,  9, 2, ADCx}, /* PA9 */
        {&gpioa, &timer1, NULL, 10, 3, ADCx}, /* PA10 */
        {&gpioa, &timer1, NULL, 11, 4, ADCx}, /* PA11 */	
        {&gpioa,   NULL, NULL, 12, 0, ADCx}, /* PA12 */
        {&gpioa,   NULL, NULL, 13, 0, ADCx}, /* PA13 */
        {&gpioa,   NULL, NULL, 14, 0, ADCx}, /* PA14 */
        {&gpioa, &timer2, NULL, 15, 1, ADCx}, /* PA15 */	

        {&gpiob, &timer3, &adc1,  0, 3,    8}, /* PB0 */
        {&gpiob, &timer3, &adc1,  1, 4,    9}, /* PB1 */
        {&gpiob,   NULL, NULL,  2, 0, ADCx}, /* PB2 */
        {&gpiob,   NULL, NULL,  3, 0, ADCx}, /* PB3 */
        {&gpiob, &timer3, NULL,  4, 1, ADCx}, /* PB4 */		
        {&gpiob, &timer3, NULL,  5, 2, ADCx}, /* PB5 */		
        {&gpiob, &timer4, NULL,  6, 1, ADCx}, /* PB6 */
        {&gpiob, &timer4, NULL,  7, 2, ADCx}, /* PB7 */
        {&gpiob, &timer4, NULL,  8, 3, ADCx}, /* PB8 */
        {&gpiob, &timer4, NULL,  9, 4, ADCx}, /* PB9 */
        {&gpiob,  NULL, NULL, 10, 0, ADCx}, /* PB10 */
        {&gpiob,  NULL, NULL, 11, 0, ADCx}, /* PB11 */
        {&gpiob,   NULL, NULL, 12, 0, ADCx}, /* PB12 */
        {&gpiob,  NULL, NULL, 13, 0, ADCx}, /* PB13 */	
        {&gpiob,   NULL, NULL, 14, 0, ADCx}, /* PB14 */	
        {&gpiob,   NULL, NULL, 15, 0, ADCx}, /* PB15 */	

        {&gpioc,   NULL, NULL, 13, 0, ADCx}, /* PC13 */
        {&gpioc,   NULL, NULL, 14, 0, ADCx}, /* PC14 */
        {&gpioc,   NULL, NULL, 15, 0, ADCx}, /* PC15 */


};

extern const uint8 boardPWMPins[BOARD_NR_PWM_PINS] __FLASH__ = {
    PB0, PB5, PA6, PA3, PA2, PA1, PA0, PB7, PB6, PA10, PA9, PA8
};
and this in my ino file...

Code: Select all

    afio_cfg_debug_ports(AFIO_DEBUG_SW_ONLY);
    afio_remap(AFIO_REMAP_TIM3_PARTIAL);
    afio_remap(AFIO_REMAP_TIM2_PARTIAL_1);
The pin is working, as I can set it HIGH or LOW and it would turn the led on... but I cant get it to run PWM. Just stays blank.
Any ideas?

Re: Updated question, How to set PA15 to GPIO Output, and PWM questions...

Posted: Thu Dec 08, 2022 6:12 pm
by stevestrong
In PIN_MAP PB15 has no timer and no channel defined. So it is normal that PWM is not working :)

Re: Updated question, How to set PA15 to GPIO Output, and PWM questions...

Posted: Thu Dec 08, 2022 6:48 pm
by Mangy_Dog
stevestrong wrote: Thu Dec 08, 2022 6:12 pm In PIN_MAP PB15 has no timer and no channel defined. So it is normal that PWM is not working :)
PB5 not PB15

Re: Updated question, How to set PA15 to GPIO Output, and PWM questions...

Posted: Fri Dec 09, 2022 1:57 am
by ag123
try calling

Code: Select all

void setup() {
	Timer3.init();
}
?

Re: Updated question, How to set PA15 to GPIO Output, and PWM questions...

Posted: Fri Dec 09, 2022 8:11 am
by stevestrong
Mangy_Dog wrote: Thu Dec 08, 2022 6:48 pm
stevestrong wrote: Thu Dec 08, 2022 6:12 pm In PIN_MAP PB15 has no timer and no channel defined. So it is normal that PWM is not working :)
PB5 not PB15
It seems that I need glasses, earlier than I thougt ;)

Re: Updated question, How to set PA15 to GPIO Output, and PWM questions...

Posted: Fri Dec 09, 2022 1:14 pm
by Mangy_Dog
ag123 wrote: Fri Dec 09, 2022 1:57 am try calling

Code: Select all

void setup() {
	Timer3.init();
}
?
That sseemed to break PWm for the other leds using that timer3...

I dont think the timer itself is the problem just the pin for some reason isnt getting routed to it. Even though its listed in the PinMap
Unless theres another place that needs setting.... Or afio remap needs calling for it.

Re: Updated question, How to set PA15 to GPIO Output, and PWM questions...

Posted: Fri Dec 09, 2022 4:01 pm
by Mangy_Dog
Ive now even tried

Code: Select all

 timer_set_compare(&timer3, 2, 32767);
So if i understand correctly it bypasses the table and "SHOULD" just force the timer on that pin at 50% duty?

Its still not working.
Is there something else taking that pin away from the timer?

Im out of ideas.