Two devices listenning on single UART port (mega8)

Go To Last Post
16 posts / 0 new
Author
Message
#1
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Hi I am solving simple problem.

I need control GSM module with HW UART
but I need also debug output channel.
I dont wish use SW_UART like bit-bang with pin becouse all pins are used

but I have one LED/pin available where can be tempovery relay during development phase

I am asking gurus if is possible
attach on single TX wire
PC terminal and SMS module
and with LED pin control relay during debugging

relay will cut-off sms module.
when my debug_printf() will send debug message to PC. after printing debug info will relay again wire SMS module.

Exist any other "clever" solution howto do that If I need SW multiplexing on single HW UART device?

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

I wouldn't use a relay. Instead use MAX232 chips that have enable lines, or use a TTL mux between the AVR and the MAX232 converters. Use you available pin to switch between the 2 mux outputs to send the data to one location or the other.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Quote:

I dont wish use SW_UART like bit-bang with pin becouse all pins are used

but I have one LED/pin available


Can you not get by with TX only bit-bang for the debug channel then?

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

clawson wrote:
Quote:

I dont wish use SW_UART like bit-bang with pin becouse all pins are used

but I have one LED/pin available


Can you not get by with TX only bit-bang for the debug channel then?

SW uarts are mostly low speed and need TIMER mostly.

I dont want use it in this case and extend and affect existing source code.
I want learn howto multiplex serial line with single HW UART device for future.

Seems to be not so easy as I think.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

dksmall wrote:
I wouldn't use a relay. Instead use MAX232 chips that have enable lines, or use a TTL mux between the AVR and the MAX232 converters. Use you available pin to switch between the 2 mux outputs to send the data to one location or the other.

What do you mean TTL mux
This is a my preffered way LED pin will switch lines later will be debug code removed with conditional compiling and normal LED function enabled.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Quote:

I dont want use it in this case and extend and affect existing source code.

But I thought you said it's only for debug purposes?

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

All the man wants to do is sniff the TX line... Just attach a wire with a resistor. No need for a relay or anything. If you are tapping the connection on the RS-232 side (not TTL) then you might also need a transistor to bring the signal down to an acceptable level.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

You can have multiple receivers on a transmit line, but you cant parallel two transmitters to a receiver. Does that help?

Imagecraft compiler user

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

If the SMS module requires a certain format for instructions, and ignores everything else, then just tie the micro's Tx data to BOTH the SMS and to a Max232 (logic level to RS-232 level), for the terminal.

The terminal will show everything. That which is sent to the SMS and that which is specifically for it.

The SMS should respond to its commands, and ignore anything else as junk.

This does not permit you to use the terminal to send commands to the micro or SMS.

JC

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

hugoboss wrote:
All the man wants to do is sniff the TX line... Just attach a wire with a resistor. No need for a relay or anything. If you are tapping the connection on the RS-232 side (not TTL) then you might also need a transistor to bring the signal down to an acceptable level.

Problem is you don't want to send debug output to the SMS, so a muxing scheme would be needed.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Define "debug output"? Usually in these situation you want to look at what is being transmitted, not some extra debug output. I think that is what was meant.

If it is in fact extra output, I would use a man in the middle scheme, where both RX and TX from and to both devices feeds into a debug unit that forwards the data and intercepts extra debug information.

Last Edited: Mon. Jun 27, 2011 - 04:54 PM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

dksmall: yes this is right what I need
but I need to know howto MUX serial line

SMS module have to be cut-off from serial line when is debug info send to PC. this is stucking SMSmodule and not responding good when receive garbage/my data.

@hugoboss: print internal variables/possition of PDU parser etc. sniffing is nice idea but not in this case. here I need data from AVR not responses from SMSmodule

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Well I tried to attach a simple example but I can't get this site to except an upload for some reason.

Here's a quickly drawn example that only needs one chip.

http://members.cox.net/~dcsmall/images/mux_example.bmp

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

hugoboss wrote:
Define "debug output"? Usually in these situation you want to look at what is being transmitted, not some extra debug output. I think that is what was meant.

Debug output could be program debug. I do this all the time where you send out something like "I'm here" or "got first byte". Just simple things that show if your code made it to certain routines. You can also send real data. Since I don't have a real debugger this is how I troubleshoot.

And of course I wouldn't want this data getting to the SMS since it might confuse it.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

exacly explained,

SMSmodule is stucking when receiving my debug data and need extra code sequence for reinit or drop values in registers and need repeat sequence or say OK but SMS is not sent.

This is the main reason why I wish have hw solution and stay on well known and available and cheap AVRmodel.

I will try this with SN7400
QUADRUPLE 2 -INPUT POSITIVE-NAND GATES - Texas Instruments

Thx

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

finally solved with HEF4053B analog switch+2x MAX232 converters.
daqq has also some nice idea use any small MCU like ATTINY and multiplex with it.
short loop and 1 input pin for UART TX and 2 outputs and one select pin
when is input high take output high but when is selectPIN also high rotate/shr PORT value faster then use IF statement.this will set other TX pin
(total 4pins used)

Currently looking for simple and single IC solution exist 2 UARTS IC with in single box with select PIN ?