I Was thinking of making a USB/RF module where there would be 3 connections on the Tx Rx UART lines (all at 5v TTL level) but I'm thinking only 2 devices will be active at a time and I don't wont the third to interfear so I should disable it right?
The connections would be
- Tx/Rx lines header pins connection for the ATmega
- Tx/Rx lines connection for FT232R USB chip
- Tx/Rx lines connection for RF tranceiver module
What I want to be able to do is:-
- use USB to RF (nothing connected to the uC header connection), should be no problem
- uC to RF, nothing connected to USB but not sure what the state of the USB chips connections will be so should disable using the reset pin (no chip select), no problem
- ATmega to USB, disable RF module so doesn't interfear with possible received random grabage however does not have a chip select pin so will disable the supply voltage.
Is the way I'm thinking of handling the above 3 scenarios adequate?
I think it should be ok, its just like a bus, only enable the parts that are communicateing so you don't get bus conflict with multiple devices trying to drive the bus.
Does anyone have any ideas or thoughts of a better way to do this?
Also I would like to power it via USB when USB is connected and via the power suply on the ATmega board when the headerpins are connected
what would be the best way to do this? use a jumper to select the power? Or would a simple diode be enough? such as
Option 1) USB power ---->|---- microcontroller +5v
Option 2) USB power ---->|---- +5v ----|<---- microcontroller
Thanks for your responses