rogerclarkmelbourne / Arduino_STM32

Arduino STM32. Hardware files to support STM32 boards, on Arduino IDE 1.8.x including LeafLabs Maple and other generic STM32F103 boards
Other
2.49k stars 1.25k forks source link

PIN_MAP and boardPWMpins tables mismatch #913

Closed board707 closed 8 months ago

board707 commented 8 months ago

in board variant STM32F1/variants/generic_stm32f103c/board.cpp

The general PIN_MAP table lists 16 timer outputs (4 timers * 4 channels each) :


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 */

  ...  // non-pwm pins skipped

    {&gpioa, &timer3, &adc1,  6, 1,    6}, /* PA6 */
    {&gpioa, &timer3, &adc1,  7, 2,    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 */
 ...
    {&gpiob, &timer3, &adc1,  0, 3,    8}, /* PB0 */    
    {&gpiob, &timer3, &adc1,  1, 4,    9}, /* PB1 */
  ...
    {&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 */ 
  ...
};

 but for some reason there are only 12 of them in the PWM pin table:

extern const uint8 boardPWMPins[BOARD_NR_PWM_PINS] __FLASH__ = {
    PB0, PA7, PA6, PA3, PA2, PA1, PA0, PB7, PB6, PA10, PA9, PA8
};
stevstrong commented 8 months ago

da6b55d981bb5a0e6c90eb2c94876cc0daf7ff9c shoud fix it.