Home
JAQForum Ver 24.01
Log In or Join  
Active Topics
Local Time 07:19 26 Nov 2024 Privacy Policy
Jump to

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 : Maximite Serial Port and "True" RS232

     Page 1 of 2    
Author Message
mookster1
Regular Member

Joined: 10/06/2011
Location: New Zealand
Posts: 81
Posted: 04:28pm 28 Aug 2012
Copy link to clipboard 
Print this post

Hi all

I'm playing around with some Dorji 433MHz radio modules (the ones Stan Swan talked about in Silicon Chip, Jan 2012) at the moment and they can only use "true" RS232 communications i.e. high=0V, low=5V. However the Maximite uses 5V as high and 0V as low. Aside from just putting a NOT gate on the board with the radio module on it, is there any software trick you can use to invert the data before it goes to the serial port?
Capacitance is futile - roll on 2012!
 
graynomad

Senior Member

Joined: 21/07/2010
Location: Australia
Posts: 122
Posted: 04:40pm 28 Aug 2012
Copy link to clipboard 
Print this post

If the modules use those logic levels then surely there are also RS232 voltage levels, in which case an inverter is not a great idea.

Is that the case?

______
Rob
Rob Gray, AKA the Graynomad, www.robgray.com
 
donmck

Guru

Joined: 09/06/2011
Location: Australia
Posts: 1313
Posted: 06:01pm 28 Aug 2012
Copy link to clipboard 
Print this post

  mookster1 said   Hi all

I'm playing around with some Dorji 433MHz radio modules (the ones Stan Swan talked about in Silicon Chip, Jan 2012) at the moment and they can only use "true" RS232 communications i.e. high=0V, low=5V. However the Maximite uses 5V as high and 0V as low. Aside from just putting a NOT gate on the board with the radio module on it, is there any software trick you can use to invert the data before it goes to the serial port?


Check out:
http://www.dorji.com/docs/data/DRF7020D13.pdf

You should be able to connect to an MCU UART without any tricks, which is usually the way they design add on chips.

Good luck with it.

Don...
https://www.dontronics.com
 
graynomad

Senior Member

Joined: 21/07/2010
Location: Australia
Posts: 122
Posted: 09:34pm 28 Aug 2012
Copy link to clipboard 
Print this post

From that PDF

[quote]RXD Input UART input, TTL level
TXD Output UART output, TTL level[/quote]

Nothing to do with RS-232 so you should be good to go.

_____
Rob


Rob Gray, AKA the Graynomad, www.robgray.com
 
ajkw
Senior Member

Joined: 29/06/2011
Location: Australia
Posts: 290
Posted: 11:36pm 28 Aug 2012
Copy link to clipboard 
Print this post

  mookster1 said   is there any software trick you can use to invert the data before it goes to the serial port?


1010 1010
XOR
1111 1111
=
0101 0101

Cheers,
Anthony.
 
graynomad

Senior Member

Joined: 21/07/2010
Location: Australia
Posts: 122
Posted: 12:06am 29 Aug 2012
Copy link to clipboard 
Print this post

You can invert the data but not the start/stop/parity bits and idle level. If you are using a hardware UART there are no software options, you have to have external hardware.

______
Rob
Rob Gray, AKA the Graynomad, www.robgray.com
 
bigmik

Guru

Joined: 20/06/2011
Location: Australia
Posts: 2914
Posted: 12:52pm 29 Aug 2012
Copy link to clipboard 
Print this post

  mookster1 said   Hi all

they can only use "true" RS232 communications i.e. high=0V, low=5V. However the Maximite uses 5V as high and 0V as low. Aside from just putting a NOT gate on the board with the radio module on it,


Hi Mookster,

I think you may be a bit confused here...

TRUE RS232 levels are a Plus and minus voltage (between 3 and 20odd volts) but usally -12 for a High and +12 for a low... The TTL side is +5 for a high and 0 for a low..

You should be able to directly connect the TTL outputs to your maximite TTL (well 3v3) levels directly without inversion.

It is extremely unlikely that any product would use `inverse RS232' levels unless they were trying to protect their design and stop people using it (hardly the point of this module).. I see nowhere in the specs that refer to it being the opposite to the maximite...

My advice is connect it up and see how you go....

regards,

Mick
Mick's uMite Stuff can be found >>> HERE (Kindly hosted by Dontronics) <<<
 
mookster1
Regular Member

Joined: 10/06/2011
Location: New Zealand
Posts: 81
Posted: 01:23pm 30 Aug 2012
Copy link to clipboard 
Print this post

Hey guys

Thanks for your responses! The reason I mentioned RS232 is that while the modules still like TTL voltage levels, according to the article data would get corrupted on the way thru the modules. I have tried just connecting it up on a breadboard and sending data out as-is and I got data through (the other end was a PICAXE 08M connected to a computer acting as a terminal, which I had already set to "true" polarity serial so the data was inverted at the receiver but I'm not too sure if it was corrupted.)

I've bashed together a function to invert strings of text, and it appears to work but I haven't yet tested if the correct data has got through the radio module okay yet. My goal is to have the Maximite and another serial terminal (including a desktop PC or my TRS80 gathering dust in the corner) send text back and forth to each other over radio. I've also thought of connecting a serial Bluetooth module to the Maximite in order to check my txt messages using a TRS80, or better yet maybe even connect it to the Internet (ordinary websites would be out of the question but using it with IRC or something like that would be a pretty cool use for old tech.)

I will let you guys know how I get on; I should hopefully get time this weekend to see if it works :)

Capacitance is futile - roll on 2012!
 
graynomad

Senior Member

Joined: 21/07/2010
Location: Australia
Posts: 122
Posted: 02:30pm 30 Aug 2012
Copy link to clipboard 
Print this post

[quote]a function to invert strings of text[/quote]
I don't get this. If the line is inverted modifying the data won't help, and if it's not inverted there's no need to modify anything.

______
Rob
Rob Gray, AKA the Graynomad, www.robgray.com
 
mookster1
Regular Member

Joined: 10/06/2011
Location: New Zealand
Posts: 81
Posted: 11:20am 02 Sep 2012
Copy link to clipboard 
Print this post

Hello again

As the radio modules require TTL-level RS232 but low=5V and high=0V, and the Maximite treats high=5V and low=0V, what I did was just inverted the bits so I was getting low as 5V and high as 0V. I have since discovered this approach does not work, probably because the start and stop bits are the wrong polarity. I'm still learning; this is really the first time I've played around with serial!

Also the only reason I'm trying to use "inverted-TTL RS232" is that that's what Stan mentioned in the article... it does seem a bit strange but using ordinary TTL, I haven't had any luck so far :(

I think I'm going to have to use another bit of hardware to do the job; my next idea is to use a PICAXE 08M to receive/transmit data to/from the Maximite in "inverted" serial, and then send/receive that data to/from the radio module. I include the PICAXE here and not a NOT gate because I've already got a couple of those on hand, and they're just as easy to use (if not probably a bit overkill).Edited by mookster1 2012-09-03
Capacitance is futile - roll on 2012!
 
graynomad

Senior Member

Joined: 21/07/2010
Location: Australia
Posts: 122
Posted: 12:12pm 02 Sep 2012
Copy link to clipboard 
Print this post

[quote]I have since discovered this approach does not work, probably because the start and stop bits are the wrong polarity.[/quote]
See my previous posts :)

Nowhere in the documentation for that module is there a mention of inverted data, quite the opposite in fact as the connection diagram shows it directly connected to a uC.

Have you verified that this is the case? I would be gobsmacked if it is.

[quote] Stan mentioned in the article[/quote]
I don't have access to the article, can you post the paragraph that gives you the impression that the data is inverted?

______
Rob
Rob Gray, AKA the Graynomad, www.robgray.com
 
mookster1
Regular Member

Joined: 10/06/2011
Location: New Zealand
Posts: 81
Posted: 01:58pm 02 Sep 2012
Copy link to clipboard 
Print this post

Hi graynomad

I don't have the magazine on me at the moment but Stan has posted a considerable amount of info on his website (go here: http://www.picaxe.orconhosting.net.nz/dorji434.htm). From the Word document on this page, here's some proof: (this was above a piece of example code)

Note- the “t” before the baud rate. These modules use a non-inverted “true” data mode (“t”) rather than inverted (“n”). True uses a high idle state,with low start & high stop comms. bits surrounding the “10101010” style 8 data bits.

I can see where you're coming from... it is a bit strange to only want data in this manner. In any case I've emailed Stan to ask him about it.
Capacitance is futile - roll on 2012!
 
graynomad

Senior Member

Joined: 21/07/2010
Location: Australia
Posts: 122
Posted: 04:49pm 02 Sep 2012
Copy link to clipboard 
Print this post

[quote]True uses a high idle state,with low start & high stop comms. [/quote]
Same as all UARTs then, not inverted.

______
RobEdited by graynomad 2012-09-04
Rob Gray, AKA the Graynomad, www.robgray.com
 
Greg Fordyce
Senior Member

Joined: 16/09/2011
Location: United Kingdom
Posts: 153
Posted: 11:09pm 02 Sep 2012
Copy link to clipboard 
Print this post

"n" is the inverted comms. This is useful if you wish to connect your microchip pic directly to a pc with RS232 without having to use a ttl-RS232 interface like the MAX232. Note that you will need some current limiting resistors or you will ruin your pic and the voltage levels won't comply with the RS232 standard, but in most cases it is good enough.

"True" is the same output as the MM or a hardware UART found on most uC.

EDIT: I think the confusion is that "True" means true TTL, not True RS232.
"n" or inverted TTL is similair to RS232. The waveforms look the same but voltage levels are different. 0-5 (or 0-3.3) for TTL and -3 to + 3 minimum for RS232.Edited by Greg Fordyce 2012-09-04
 
donmck

Guru

Joined: 09/06/2011
Location: Australia
Posts: 1313
Posted: 09:05am 03 Sep 2012
Copy link to clipboard 
Print this post

mookster1, you appeared to have confused what every manufacturer is trying to achieve when they design a silicon product that connects directly to a micro. It connects to the UART direct. Myself and many others have told you this, but you don't seem convinced.

The software is RS-232 protocol. The hardware is basically TTL. There is no inversion if they are connected directly to each other.

Because the old RS-232 hardware was achieved initially with transistors driving +/- 12 volts, an inversion took place. Voltages are a lot lower with MAX-232 type of devices used in modern equipment. Old driving distance was quoted as 50 feet using the 12 volt system.

If you hooked into a DB-9 or DB-25 RS-232 connector, you were at hardware RS-232 levels, and an inversion was required to get to the micro (or PC) and the peripheral. This usually meant a matching Max-232 type device, and this is why people talk about needing inversion, if you break in at the wrong point.

Idea was if you connect up two devices that are designed to be connected together such as a PC and a serial printer, all is well. If you try to connect the serial printer to a micro, you need either an inverter such as a Max-232, or you break into the schematic and grab the TTL signal.

This reminds me of the old argument about RX and TX. Which is which? Depends on which schematic you are looking at. As long as you cross them over between devices.

Make sure the outs connect to the ins, and ins to outs. Chip data always shows this info.

Don...




Edited by donmck 2012-09-04
https://www.dontronics.com
 
mookster1
Regular Member

Joined: 10/06/2011
Location: New Zealand
Posts: 81
Posted: 05:04pm 03 Sep 2012
Copy link to clipboard 
Print this post

Ah ha! It makes sense!

Sorry, I think I understand where I've been going wrong now, the reason for my confusion is that I always assumed inverted serial ("n" baud rates with PICAXE) was ordinary TTL serial. Sorry for being frustrating!

Okay then, that's going to make things a lot easier then. My issue may have been that I was using the wrong baud rate to send data to the module (I initially didn't read the datasheet; I just relied on the article and was sending data to the module at 1200bps when I should have been sending it at 9600bps). I've set up the module so it's talking directly to the Maximite, so I'll experiment a bit more when I get some more time.

Thanks!
Capacitance is futile - roll on 2012!
 
MicroBlocks

Guru

Joined: 12/05/2012
Location: Thailand
Posts: 2209
Posted: 07:05pm 03 Sep 2012
Copy link to clipboard 
Print this post

I had some issues using picaxe chips connected to the maximite.
Of course the inverted/normal issue was the first problem and i was lucky to have the source of the picaxe program.
When that was fixed i still did not get data into the picaxe but receiving from the picaxe was no problem, did not matter which baudrate.

Finally the problem was isolated to the picaxe using bitbanging for the serial interface, picaxe do have a hardware uart, but this particular software used general io pins.

I hooked up a logic analyzer to see if the signal was correct and indeed it was, comparing the picaxe output and the maximite output showed that the picaxe had a small 5-6 ms delay between the characters.
I changed my output routine of the maximite inserting those delays and from that moment it worked flawless.



Microblocks. Build with logic.
 
graynomad

Senior Member

Joined: 21/07/2010
Location: Australia
Posts: 122
Posted: 08:36pm 03 Sep 2012
Copy link to clipboard 
Print this post

Which basically means that the Picaxe couldn't keep up with the continuous data flow.

My guess is that the core function that reads a byte is good but the interpreted code that does something with it is too slow.

What was the baud rate?

______
RobEdited by graynomad 2012-09-05
Rob Gray, AKA the Graynomad, www.robgray.com
 
MicroBlocks

Guru

Joined: 12/05/2012
Location: Thailand
Posts: 2209
Posted: 11:59pm 03 Sep 2012
Copy link to clipboard 
Print this post

It even happened at 300 baud. the picaxe was running at 16Mhz.
Has to be something in the picaxe firmware that cannot distinguish two or more characters being send back to back. You would think stop and startbits would solve that problem. :)

Having two picaxes 'talk' to eachother was no problem but now i think about it again those were N9600, maybe being inverted has something to do about it because then the logic levels for the start and stopbits would be opposite.

After many tries i just settled on the delay, as i was only sending data to a lcd character display and even with the delay it was fast enough.


Microblocks. Build with logic.
 
graynomad

Senior Member

Joined: 21/07/2010
Location: Australia
Posts: 122
Posted: 05:07am 04 Sep 2012
Copy link to clipboard 
Print this post

[quote]You would think stop and startbits would solve that problem.[/quote]
Not really, the start and stop bits are being handled correctly or you wouldn't be getting any valid characters at all.

It's the processing time between characters that is the problem.

That it couldn't keep up at 300bps I find pretty amazing but it depends on how the characters were being handled.Edited by graynomad 2012-09-05
Rob Gray, AKA the Graynomad, www.robgray.com
 
     Page 1 of 2    
Print this page
© JAQ Software 2024