Notice. New forum software under development. It's going to miss a few functions and look a bit ugly for a while, but I'm working on it full time now as the old forum was too unstable. Couple days, all good. If you notice any issues, please contact me.
|
Forum Index : Microcontroller and PC projects : Picomites as I/O Expanders
Author | Message | ||||
LouisG Senior Member Joined: 19/03/2016 Location: AustraliaPosts: 124 |
Hi everyone! I'm experimenting with using Picomites as smart I/O expanders. Below is the setup I made on stripboard for creating 72 discrete outputs using 3 Picomites. The three simultaneously receive bitbang transmissions once per second of serial information at 4800 baud from a master Picomite, which updates the relevant outputs of the three Picos. Program-wise it all works well. However, something odd is going on when powering up the three Picos. (The master Pico has its own power source.) As you can see, a single USB cable powers all three by virtue of interconnecting their VBus pins. The idea is to be able to 1. Choose between a USB plug-pack or a laptop as the power source 2. Power all three Picos simultaneously 3. Connect to one of the three Picos for program updates. If I power up the three Picos without the master Pico powered, all three start flashing normally after a few seconds. If the master Pico is powered and transmitting and only then the three Picos are powered up, none of them achieve proper start-up and do not flash. I checked their Pin 36 voltages. All were 3.3V. If the master Pico is then switched off, the three Picos do not resume normal flashing. They had to have power removed and restored to get them all flashing again. It appears to me that somehow the incoming data stream to the Picos' pin 34 interferes with their starting-up routine, causing them to fail to reach flashing. I suppose I could arrange to always start the three output Picos first and then afterwards the master Pico but it doesn't sound right to me. My questions: 1. Any ideas anyone? 2. Is the above method of powering all three Picos from one USB cable valid? The pin loading presently is near zero. The eventual maximum pin loading for all three could only ever be 35 or 40mA (to optocouplers). Regards, Louis - |
||||
Mixtel90 Guru Joined: 05/10/2019 Location: United KingdomPosts: 6792 |
Yes, you can power all three like that, but you must never connect more than one of them to a supply because they all back feed to VBUS. GPx pins on the chips float until initialised with SETPIN. It might be an idea to put a pulldown on the TX line to make sure it's in a known state. Unfortunately this means that TX now has to be active high. and you must power up the master first. The reason for this is that it's not a good idea to put a voltage on a GPx pin from another source while it is being powered up. ESD protection on the pins connects the input voltage to the supply rail so the processor may be trying to start in an indeterminate state because of low VCC. By having an active high data signal this doesn't happen. Be careful when driving loads from the Pico. The current per pin is reasonable but the total allowable current into the IO side is only 50mA *in total* including QSPI. Over 24 pins that's only 2mA each maximum if they are all on. Take it too far and you will fuse the bonding wire onto the die. You could make this comms system better by opto-coupling the TX signal to each Pico individually, each having its own pullup to its own VCC. It doesn't matter what order anything powers up then. You would need some decently fast opto-couplers though. Edited 2023-12-28 01:55 by Mixtel90 Mick Zilog Inside! nascom.info for Nascom & Gemini Preliminary MMBasic docs & my PCB designs |
||||
PhenixRising Guru Joined: 07/11/2023 Location: United KingdomPosts: 859 |
I have done this with PicoMites and tested @ 920K Baud. |
||||
Volhout Guru Joined: 05/03/2018 Location: NetherlandsPosts: 4235 |
By connecting only the serial tx, you can create additional outputs, but not additional inputs. Then you also need connect the rx pins. There have been several proposals how to connect multiple uart outputs to a single master rx pin. Connecting rx also gives the option slaves send an acknowledge to confirm they understand the command send Volhout PicomiteVGA PETSCII ROBOTS |
||||
PhenixRising Guru Joined: 07/11/2023 Location: United KingdomPosts: 859 |
Yup, I use binary xfers+checksum. Slaves acknowledge with a status byte where bit-0 indicates if there was a checksum error on the last-received packet. Protocol format: Header byte: AA Address byte: 01 to FF Control byte: Upper nibble = instruction, lower nibble = # of data bytes following. Data byte(s): However many to suit Checksum byte. Using Port and bin2str makes for very fast updates. |
||||
mozzie Regular Member Joined: 15/06/2020 Location: AustraliaPosts: 68 |
G'day Louis, Something funny going on there, can you tell us what version of mmbasic you are running and the line of code for the serialrx command? I'll assume you have autorun set on the slaves. A quick test shows that if the serialrx pin is low when the command is issued the pico stops running, no heartbeat and no console response. The serial idle state is high and this might be the expected state when the command runs. Some more testing required.... Regards, Lyle. |
||||
LouisG Senior Member Joined: 19/03/2016 Location: AustraliaPosts: 124 |
Hi All, The problem is solved. Thanks for pointing me in the right direction. It wasn't anything to do with software. It was some kind of interaction between the two 5V power supplies: one for the Master Pico and one for the three slave Picos. To eliminate the interaction I ran all 4 Picos off just one power supply. No more weird effects! I'll probably never know if it was common mode AC, floating DC potential or switching noise. I wouldn't have figured it out without your inputs prodding my thinking. Thanks PhenixRising for the very interesting Multidrop article. One day I'll describe what all this is for. Regards and Happy New Year. ... Louis |
||||
Mixtel90 Guru Joined: 05/10/2019 Location: United KingdomPosts: 6792 |
If the nodes are reasonably close together and you can spare an extra pin then I2C is a good way to go. It's easy to use in MMBasic, unbuffered (so you know you are seeing the data *now* rather than from a buffer), bi-directional and (if you do your software right) hot-pluggable. Also, you could consider some of the Pico clone boards as slave devices. There are some with the pins laid out in a more logical manner for some purposes and with a few more IO pins (like GP23 and GP29). Mick Zilog Inside! nascom.info for Nascom & Gemini Preliminary MMBasic docs & my PCB designs |
||||
Print this page |