go away spammer

Author Topic: two devices with one UART?  (Read 4105 times)

0 Members and 1 Guest are viewing this topic.

Offline AdminTopic starter

  • Administrator
  • Supreme Robot
  • *****
  • Posts: 11,703
  • Helpful? 173
    • Society of Robots
two devices with one UART?
« on: July 23, 2007, 06:26:48 PM »
I want to control both my CMUcam and have a bluetooth connection simultaneously with my ATmega168. Since they both require UART, is this possible?

My guess is that the CMUcam will ignore incorrect commands, and on the bluetooth side I can ignore any data that is CMUcam commands. But not really sure . . .

Or am I being noob like?

Offline hgordon

  • Expert Roboticist
  • Supreme Robot
  • *****
  • Posts: 373
  • Helpful? 7
    • Surveyor Robotics Journal
Re: two devices with one UART?
« Reply #1 on: July 23, 2007, 08:56:45 PM »
I know the feeling of not having enough serial ports, but it's unlikely that the attached devices would handle the confusion, not to mention issues of different devices pulling the signal lines in opposite directions at the same time.  The only thing you might consider is to add a set of digital switches that route the UART lines between devices under software control.
Surveyor Corporation
  www.surveyor.com

Offline AdminTopic starter

  • Administrator
  • Supreme Robot
  • *****
  • Posts: 11,703
  • Helpful? 173
    • Society of Robots
Re: two devices with one UART?
« Reply #2 on: July 24, 2007, 05:44:00 AM »
Quote
The only thing you might consider is to add a set of digital switches that route the UART lines between devices under software control.
Good idea!

Hmmm the best way I can think of doing this is with 4 mosfets (one for each tx and rx line), an inverter, and one digital I/O line. Is there a better way to do this? I feel as if there might be an IC out there already for this . . .

Offline Hal9000

  • Supreme Robot
  • *****
  • Posts: 338
  • Helpful? 0
Re: two devices with one UART?
« Reply #3 on: July 24, 2007, 06:13:30 AM »
I've been doing DSP, but on the maths and not the practicalities!

Aren't you looking for a multiplexer or sorts?
"The truth is, you can't hide from the truth, cos the truth is all there is" - Handsome Boy Modeling School

Offline JonHylands

  • Expert Roboticist
  • Supreme Robot
  • *****
  • Posts: 562
  • Helpful? 3
  • Robot Builder/ Software Developer
    • Jon's Place
Re: two devices with one UART?
« Reply #4 on: July 24, 2007, 06:22:24 AM »
Admin,

Check out the ATmega162 - its a DIP 40, but its got two hardware UARTs.

- Jon

Offline dunk

  • Expert Roboticist
  • Supreme Robot
  • *****
  • Posts: 1,086
  • Helpful? 21
    • dunk's robot
Re: two devices with one UART?
« Reply #5 on: July 24, 2007, 06:36:27 AM »
Quote
Check out the ATmega162 - its a DIP 40, but its got two hardware UARTs.
yup. there's quite a few AVRs out there with multiple UARTs.

alternatively you could use one hardware UART and bit bang a 2nd.

dunk.

Offline hgordon

  • Expert Roboticist
  • Supreme Robot
  • *****
  • Posts: 373
  • Helpful? 7
    • Surveyor Robotics Journal
Re: two devices with one UART?
« Reply #6 on: July 24, 2007, 09:28:03 AM »
alternatively you could use one hardware UART and bit bang a 2nd.
dunk.
Bit banging is a good idea - leave the bluetooth on the UART, since it will be receiving asynchronous requests from the host, while the CMUcam is always under processor control, so you won't lose any data when not watching that software port.
Surveyor Corporation
  www.surveyor.com

 


Get Your Ad Here