Certain pin names cause the Pico to disconnect. #641
Replies: 6 comments
-
Posted at 2016-10-30 by user66772 I think I'm going to answer my own question... Pin A9 of the on-board STM32 microcontroller is always connected to the fused USB 5V voltage reference. bows |
Beta Was this translation helpful? Give feedback.
-
Posted at 2016-10-30 by @gfwilliams Yeah, the 'other' pins are all shown here, with what they're connected to (if you hover over the tags): http://www.espruino.com/Pico#pinout Setting A9's not going to be great for the chip - it's just left available in case someone wants to use it (eg if USB isn't connected). In the absolute latest revision of the board it's actually connected via a resistor to minimize damage though. digitalWrite won't throw an exception unless you give it an invalid pin name like "foo" - it'll just tell the hardware what to set the pin to - whether or not the hardware will actually do that or not depends on how it's set up and is pretty complex :) In the case of the IO brought out on pins it should 'just work'. |
Beta Was this translation helpful? Give feedback.
-
Posted at 2016-10-30 by user66772 Is there away to programatically list all physical pins, (or better) all global variables? |
Beta Was this translation helpful? Give feedback.
-
Posted at 2016-10-31 by DrAzzy What use would that have outside of testing? Or are you writing tests for Espruino to validate modified builds or something? |
Beta Was this translation helpful? Give feedback.
-
Posted at 2016-10-31 by @gfwilliams You can just do But again, if you just try what you did above with all pins you could damage your board (and will definitely break USB), as you have no idea what they're connected to when you set them to something. |
Beta Was this translation helpful? Give feedback.
-
Posted at 2016-10-31 by user66772 Hmm good point DrAzzy. I'm attempting to make a virtual pin registry for in case I want to use multiplexers and shift registers in tandem with each other. In a custom wrapper for espruino, those devices could be used as a source of pins, by switching the selector pins in the background to accommodate calls to a virtual pin. I have already created a workaround without too many lines. But I will try Object.keys(global) . I totally forgot about javascript being rooted in Java where everything stems from the Object object lol. And thanks for getPinMode Gordon. It's definitely worth it to leave pins such as A9 usable by any project. My workaround so far is such that I create virtual pin objects starting with 'Z0' through 'Z7' when initiating a 74HC595 shift register, then slapping them with a "digital output only" flag. |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
Posted at 2016-10-29 by user66772
I am running a try {} block in which i test each possible pin name to see if it will respond to a digitalWrite.
Neither B2 or A9 exist on the pico board, but B2 is accepted by this pin testing approach and A9 causes the device to disconnect itself.
Does anybody have an explanation for this? I can work around it, but I'm curious nonetheless.
Beta Was this translation helpful? Give feedback.
All reactions