|
Forum Index : Microcontroller and PC projects : PicoMite: what's wrong with SETPIN 17,PWM0A?
| Author | Message | ||||
| lizby Guru Joined: 17/05/2016 Location: United StatesPosts: 3478 |
PicoMite MMBasic Version 5.07.00a48 Copyright 2011-2021 Geoff Graham Copyright 2016-2021 Peter Mather > SETPIN 1,PWM0A > SETPIN 17,PWM0B Error : Invalid configuration > new > setpin 17,PWM0A Error : Invalid configuration > PicoMite MMBasic Version 5.07.00a48 Copyright 2011-2021 Geoff Graham Copyright 2016-2021 Peter Mather > setpin 17,PWM0A Error : Invalid configuration > > option list OPTION SYSTEM I2C GP10,GP11 OPTION LCDPANEL SSD1306I2C, LANDSCAPE OPTION RTC AUTO ENABLED OPTION GUI CONTROLS 59 OPTION MEMORY 60160, 100608 > ~ Edited 2021-07-17 03:21 by lizby PicoMite, Armmite F4, SensorKits, MMBasic Hardware, Games, etc. on fruitoftheshed |
||||
| Mixtel90 Guru Joined: 05/10/2019 Location: United KingdomPosts: 8297 |
Don't you have to configure them in matching slices, as per page 101 of the Micropython book? So PWM_A[0] on pin 1 is paired with PWM_B[0] on pin 2 or PWM_B[0] on pin 22. Not sure... Mick Zilog Inside! nascom.info for Nascom & Gemini Preliminary MMBasic docs & my PCB designs |
||||
| matherp Guru Joined: 11/12/2012 Location: United KingdomPosts: 10610 |
pin 22 == GP17 Edited 2021-07-17 03:54 by matherp |
||||
| lizby Guru Joined: 17/05/2016 Location: United StatesPosts: 3478 |
I wasn't looking for GP17, but pin 17, GP13. PicoMite, Armmite F4, SensorKits, MMBasic Hardware, Games, etc. on fruitoftheshed |
||||
| matherp Guru Joined: 11/12/2012 Location: United KingdomPosts: 10610 |
GP13 is PWM06B { 1, 0, "GP0", DIGITAL_IN | DIGITAL_OUT | UART0TX | SPI0RX | I2C0SDA | PWM0A,99,0}, // pin 1 { 2, 1, "GP1", DIGITAL_IN | DIGITAL_OUT | UART0RX | I2C0SCL | PWM0B ,99,128}, // pin 2 { 3, 99, "GND", UNUSED ,99,99}, // pin 3 { 4, 2, "GP2", DIGITAL_IN | DIGITAL_OUT | SPI0SCK | I2C1SDA | PWM1A ,99,1}, // pin 4 { 5, 3, "GP3", DIGITAL_IN | DIGITAL_OUT | SPI0TX | I2C1SCL | PWM1B ,99,129}, // pin 5 { 6, 4, "GP4", DIGITAL_IN | DIGITAL_OUT | UART1TX | SPI0RX | I2C0SDA | PWM2A ,99,2}, // pin 6 { 7, 5, "GP5", DIGITAL_IN | DIGITAL_OUT | UART1RX | I2C0SCL | PWM2B ,99,130}, // pin 7 { 8, 99, "GND", UNUSED ,99, 99}, // pin 8 { 9, 6, "GP6", DIGITAL_IN | DIGITAL_OUT | SPI0SCK | I2C1SDA | PWM3A ,99, 3}, // pin 9 { 10, 7, "GP7", DIGITAL_IN | DIGITAL_OUT | SPI0TX | I2C1SCL | PWM3B ,99, 131}, // pin 10 { 11, 8, "GP8", DIGITAL_IN | DIGITAL_OUT | UART1TX | SPI1RX | I2C0SDA | PWM4A ,99, 4}, // pin 11 { 12, 9, "GP9", DIGITAL_IN | DIGITAL_OUT | UART1RX | I2C0SCL | PWM4B ,99, 132}, // pin 12 { 13, 99, "GND", UNUSED ,99, 99}, // pin 13 { 14, 10, "GP10", DIGITAL_IN | DIGITAL_OUT | SPI1SCK | I2C1SDA | PWM5A ,99, 5}, // pin 14 { 15, 11, "GP11", DIGITAL_IN | DIGITAL_OUT | SPI1TX | I2C1SCL | PWM5B ,99, 133}, // pin 15 { 16, 12, "GP12", DIGITAL_IN | DIGITAL_OUT | UART0TX | SPI1RX | I2C0SDA | PWM6A ,99, 6}, // pin 16 { 17, 13, "GP13", DIGITAL_IN | DIGITAL_OUT | UART0RX | I2C0SCL | PWM6B ,99, 134}, // pin 17 { 18, 99, "GND", UNUSED ,99, 99}, // pin 18 { 19, 14, "GP14", DIGITAL_IN | DIGITAL_OUT | SPI1SCK | I2C1SDA | PWM7A ,99, 7}, // pin 19 { 20, 15, "GP15", DIGITAL_IN | DIGITAL_OUT | SPI1TX | I2C1SCL | PWM7B ,99, 135}, // pin 20 { 21, 16, "GP16", DIGITAL_IN | DIGITAL_OUT | UART0TX | SPI0RX | I2C0SDA | PWM0A ,99, 0}, // pin 21 { 22, 17, "GP17", DIGITAL_IN | DIGITAL_OUT | UART0RX | I2C0SCL | PWM0B ,99, 128}, // pin 22 { 23, 99, "GND", UNUSED ,99, 99}, // pin 23 { 24, 18, "GP18", DIGITAL_IN | DIGITAL_OUT | SPI0SCK | I2C1SDA | PWM1A ,99, 1}, // pin 24 { 25, 19, "GP19", DIGITAL_IN | DIGITAL_OUT | SPI0TX | I2C1SCL | PWM1B ,99, 129}, // pin 25 { 26, 20, "GP20", DIGITAL_IN | DIGITAL_OUT | I2C0SDA | PWM2A ,99, 2}, // pin 26 { 27, 21, "GP21", DIGITAL_IN | DIGITAL_OUT | I2C0SCL | PWM2B ,99, 130}, // pin 27 { 28, 99, "GND", UNUSED ,99, 99}, // pin 28 { 29, 22, "GP22", DIGITAL_IN | DIGITAL_OUT | PWM3A ,99, 3}, // pin 29 { 30, 99, "RUN", UNUSED ,99, 99}, // pin 30 { 31, 26, "GP26", DIGITAL_IN | DIGITAL_OUT | ANALOG_IN | I2C1SDA | PWM5A , 0 , 5}, // pin 31 { 32, 27, "GP27", DIGITAL_IN | DIGITAL_OUT | ANALOG_IN | I2C1SCL | PWM5B , 1 , 133}, // pin 32 { 33, 99, "AGND", UNUSED ,99, 99}, // pin 33 { 34, 28, "GP28", DIGITAL_IN | DIGITAL_OUT | ANALOG_IN | PWM6A , 2 , 6}, // pin 34 { 35, 99, "VREF", UNUSED ,99, 99}, // pin 35 { 36, 99, "3V3", UNUSED ,99, 99}, // pin 36 { 37, 99, "3V3E", UNUSED ,99, 99}, // pin 37 { 38, 99, "GND", UNUSED ,99, 99}, // pin 38 { 39, 99, "VSYS", UNUSED ,99, 99}, // pin 39 { 40, 99, "VBUS", UNUSED ,99, 99}, // pin 40 |
||||
| lizby Guru Joined: 17/05/2016 Location: United StatesPosts: 3478 |
Ah, thanks. I missed that configuration. Does that imply that pin 16 is not available as DOUT or DIN if pin 17 is configured as PWM? PicoMite, Armmite F4, SensorKits, MMBasic Hardware, Games, etc. on fruitoftheshed |
||||
| lizby Guru Joined: 17/05/2016 Location: United StatesPosts: 3478 |
So the answer is "yes". PicoMite MMBasic Version 5.07.00a48 Copyright 2011-2021 Geoff Graham Copyright 2016-2021 Peter Mather > setpin 17,PWM6b > PWM 6,1000,0,50 Error : Pin not set for PWM > setpin 16,PWM6a > PWM 6,1000,0,50 > (And the PWMed LED on pin 17 comes on.) My immediate problem is that I've allocated pin 16 for SPI2 MISO. Some head-scratching is in order. By the way, does this accurately display what's available in the way of PWM? ![]() ~ Edited 2021-07-17 10:15 by lizby PicoMite, Armmite F4, SensorKits, MMBasic Hardware, Games, etc. on fruitoftheshed |
||||
| Mixtel90 Guru Joined: 05/10/2019 Location: United KingdomPosts: 8297 |
That agrees with the Micropython book, so I assume it does. :) Mick Zilog Inside! nascom.info for Nascom & Gemini Preliminary MMBasic docs & my PCB designs |
||||
| matherp Guru Joined: 11/12/2012 Location: United KingdomPosts: 10610 |
PWM channel, frequency, [duty1] [,duty2] PWM channel, OFF Try setpin 17,PWM6b PWM 6,1000,,50 Edited 2021-07-17 18:20 by matherp |
||||
| robert.rozee Guru Joined: 31/12/2012 Location: New ZealandPosts: 2466 |
peter, would there be any material difference between the below two code snipets? setpin 16,PWM6a setpin 17,PWM6b and setpin 16,PWM setpin 17,PWM the PWM channel number (0-7) and letter (a or b) associated with any given pin is fixed (eg, pin 17, when configured for PWM, can only ever be channel 6b), so there seems no real point in explicitly stating the channel number/letter in the setpin command. given the above is accepted, it further (but separately) seems that with the PWM command: PWM channel, frequency, [duty1] [,duty2] it may be more intuitive (albeit not syntactically compatible with other mmbasic versions) to use the pin number instead of the channel number/name. the firmware can always, unambiguously, resolve the pin number back to the channel number and letter, and an error can be generated if an incompatible pin number is used (eg, 21/22 instead of 1/2 if pins 1 and 2 have previously been configured for PWM with setpin). cheers, rob :-) Edited 2021-07-17 21:11 by robert.rozee |
||||
| lizby Guru Joined: 17/05/2016 Location: United StatesPosts: 3478 |
That does the trick. Thank you. No need to rethink the configuration and scramble traces. PicoMite, Armmite F4, SensorKits, MMBasic Hardware, Games, etc. on fruitoftheshed |
||||
| The Back Shed's forum code is written, and hosted, in Australia. | © JAQ Software 2025 |