Home
JAQForum Ver 24.01
Log In or Join  
Active Topics
Local Time 15:56 06 Jul 2025 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 : Serial comms to Picaxe

Author Message
Bizzie
Senior Member

Joined: 06/07/2014
Location: Australia
Posts: 192
Posted: 02:01pm 07 Mar 2016
Copy link to clipboard 
Print this post

Hi all,

Has anyone successfully communicated between the programming port of a Picaxe (20X2 in my case) and either a USB to serial adapter (Freetronics in my case set to 5v) or an MM+?

I have a logger I designed and built back in about 2009 using Picaxe 20X2's. The data comes out as 9600 baud serial which displays as expected on the genuine PC serial port (old laptop running XP and Hyper terminal!).

BUT

If I connect the output to my USB to serial card and TeraTerm - nothing! I have done the usual switching of the Rx and Tx lines still nothing.

I have also tried setting up an MM+ and can not get any communications either.

Anyone any thoughts?

Rob White
 
JohnS
Guru

Joined: 18/11/2011
Location: United Kingdom
Posts: 4036
Posted: 02:35pm 07 Mar 2016
Copy link to clipboard 
Print this post

Ideas:
1. signals are inverted
2. voltages are wrong
3. (not so likely) handshaking is wrong/needed

JohnEdited by JohnS 2016-03-09
 
Bizzie
Senior Member

Joined: 06/07/2014
Location: Australia
Posts: 192
Posted: 02:41pm 07 Mar 2016
Copy link to clipboard 
Print this post

Thanks John,

They were about my thoughts and the reason I tried the MM+ so I could invert the signal.
Rob White
 
bigmik

Guru

Joined: 20/06/2011
Location: Australia
Posts: 2949
Posted: 06:01pm 07 Mar 2016
Copy link to clipboard 
Print this post

Hi Rob,

From your description it sounds like your interface on the picaxe is RS232 levels..

What levels are the freetronics usb board? Most of the usb-serial adapters are TTL (3v3 or 5v levels). If the above is the case you will need to grab the TTL lines on the picaxe before they get converted to RS232 level..

I assume that you have got the freetronics adapter working with teraterm by itself when you short Rx to Tx??

Regards,

Mick


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

Joined: 06/07/2014
Location: Australia
Posts: 192
Posted: 06:47pm 07 Mar 2016
Copy link to clipboard 
Print this post

Mick,

That's whats got me confused! The board (an AXE118) just uses the circuit on page 31 of the Picaxe Manual 1. To a stereo plug (see page 43 same manual). I assume that to run a 5v.

My Freetronics USB-Serial is 3.3/5v switchable, I am using 5v BUT this may become a problem when I try to use the MM+ on 3.3v

Yes the adapter board works when looped back.
Rob White
 
bigmik

Guru

Joined: 20/06/2011
Location: Australia
Posts: 2949
Posted: 07:44pm 07 Mar 2016
Copy link to clipboard 
Print this post

Hi Rob,

Ok, we are getting there...the circuit is a 'bastardised RS232' circuit ... It is inverted logic (compared to TTL levels).

RS232 is traditionally a swing of +12v or -12v what they are relying on is the 22k resistor reducing the current and the pic internal diodes to clip the + and - voltages to not kill the input.. The output will swing 0v to 5v which most PC serial ports (but not all especially some laptops) will work with, at least over relatively short cable lengths 1m or 2..

To use a TTL USB serial adapter as you are doing will need an inverter or using the micromite inverted Comms commands (not sure of syntax for those) but the 22k is probably too high you would need to use something around 1k or short it out. You should add a 1k in series with the serial out to avoid damage to a 3v3 level micromite.

I hope that makes some sense...

Of course a USB to RS232 serial adapter will probably work but nay not due to the bastardised circuit.

Regards,


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

Joined: 06/07/2014
Location: Australia
Posts: 192
Posted: 07:56pm 07 Mar 2016
Copy link to clipboard 
Print this post

Thanks Mick,

Will try that and get back to you.
Rob White
 
Bizzie
Senior Member

Joined: 06/07/2014
Location: Australia
Posts: 192
Posted: 08:12pm 07 Mar 2016
Copy link to clipboard 
Print this post

Mick,

I am seeing "some garbage" which I assume is inverted ascii codes. Is three any terminal programs you (or anyone else) know of or do I have to use am MM? I can not see anywhere TT can do it.

I would like to verify the output and be able to transmit the request for data before anything else (kiss principle).

Rob White
 
Grogster

Admin Group

Joined: 31/12/2012
Location: New Zealand
Posts: 9589
Posted: 08:21pm 07 Mar 2016
Copy link to clipboard 
Print this post

Provided you are NOT using SERTXD(which is fixed), you should be able to change the serial from Nxxxx to Txxxx in the baud part of the SEROUT command:

SEROUT 1,N2400..... to SEROUT 1,T2400..... kind of thing.

This should then output a bog-standard serial from the picaxe, that anything with a TTL input should respond to - terminals like Geoff's VT100, the MM or MM+, USB-serial adaptors etc....

The fact that you are getting garbage means SOMETHING is happening(data is going out), and that is normally one of two things: (1) Baud-rate is wrong or (2) Data is inverted.

EDIT:
  Bizzie said  My Freetronics USB-Serial is 3.3/5v switchable, I am using 5v BUT this may become a problem when I try to use the MM+ on 3.3v


COM1 is 5v tolerant, so you can connect your 5v picaxe, to the MM or MM+ powered from 3v3 if you use COM1. Look for the "5v" label in the manual for the pinouts.Edited by Grogster 2016-03-09
Smoke makes things work. When the smoke gets out, it stops!
 
Bizzie
Senior Member

Joined: 06/07/2014
Location: Australia
Posts: 192
Posted: 08:32pm 07 Mar 2016
Copy link to clipboard 
Print this post

Thanks Grogster,

Unfortunately I am using SERTXD! I was hoping not to have to reprogram it. No spare pins without some rework.
Rob White
 
bigmik

Guru

Joined: 20/06/2011
Location: Australia
Posts: 2949
Posted: 08:39pm 07 Mar 2016
Copy link to clipboard 
Print this post

Hi Rob,

I doubt that teraterm could be told to work with inverted data as the start and stop bits will be inverted as well and the uart on the adapter would probably not, read Will not, read them correctly.

Your only choices are to write code for a micromite that supports inverted Comms, or fit inverters in series on both in and out if bidirectional is required or as Grogs suggests, modifying the picaxe code if that is an option.

Regards,

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

Joined: 06/07/2014
Location: Australia
Posts: 192
Posted: 08:45pm 07 Mar 2016
Copy link to clipboard 
Print this post

Thanks Mick,

Looks like some rework is in order. This was one of my first projects with PicAxes so am sure I can gain some pins.
Thanks for your and Grogsters help.
Rob White
 
bigmik

Guru

Joined: 20/06/2011
Location: Australia
Posts: 2949
Posted: 08:53pm 07 Mar 2016
Copy link to clipboard 
Print this post

Rob,

You only need a standard npn transistor and 2 resistors to knock up an inverter... Of course one for Tx and one for Rx

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

Joined: 08/08/2014
Location: United Kingdom
Posts: 164
Posted: 11:05pm 07 Mar 2016
Copy link to clipboard 
Print this post

The PICAXE was originally setup to use the data coming directly from a PC RS232 Serial port at +/- 12V levels.

From a Microcontrollers perspective the RS232 to TTL converter chip (such as MAX232) inverts the incoming serial data.

So what we commonly see from TTL level serial devices, GPSs, MMs etc is inverted with respect to RS232 levels.

If your using a FTDI adapter then this can be setup with their programming utility to change the serial polarity, so that you can then read the data from a PICAXE. Edited by srnet 2016-03-09
$50SAT is Silent but probably still working.
For information on LoRa visit http://www.loratracker.uk/

 
Bill.b

Senior Member

Joined: 25/06/2011
Location: Australia
Posts: 235
Posted: 11:12am 08 Mar 2016
Copy link to clipboard 
Print this post

The SERTXD Command has a fixed baurd rate as below.

Serial output via the serout programming pin (baud 4800, 8 data, no parity, 1
stop).

Bill
In the interests of the environment, this post has been constructed entirely from recycled electrons.
 
srnet
Senior Member

Joined: 08/08/2014
Location: United Kingdom
Posts: 164
Posted: 11:49am 08 Mar 2016
Copy link to clipboard 
Print this post

SERTXD defaults to 9600 baud on the X2 part mentioned in the first post in the thread.

And the baud rate is not 'fixed' as it varies if you change the operating frequency of the PICAXE with SETFREQ.
$50SAT is Silent but probably still working.
For information on LoRa visit http://www.loratracker.uk/

 
jeffj
Regular Member

Joined: 04/02/2012
Location: Australia
Posts: 84
Posted: 01:49am 30 Sep 2016
Copy link to clipboard 
Print this post

Hi folks I am having a problem with Comms from micromite to win 10
I am using a AXE 027 and an invertor
All ok on desktop running Teraterm or MMEdit on XP
The invertor connects to the 3.3 volts of the u mite I suspect this may be borderline
Neither Teraterm or MMEdit recognises the link . I updated the driver. Swapped ports.
Serial port is present in Device manager.
AXE is the ex pic axe serial sub cable.
Any ideas would be welcome.
PS It used to work ok
Jeff
 
srnet
Senior Member

Joined: 08/08/2014
Location: United Kingdom
Posts: 164
Posted: 08:26am 30 Sep 2016
Copy link to clipboard 
Print this post

I dont know about the driver issue, but there is no need to use an inverter with a AXE027, its an FTDI device and their utility will allow you to turn off the inversion that is normal for PICAXE program lead.
$50SAT is Silent but probably still working.
For information on LoRa visit http://www.loratracker.uk/

 
jeffj
Regular Member

Joined: 04/02/2012
Location: Australia
Posts: 84
Posted: 07:13pm 02 Oct 2016
Copy link to clipboard 
Print this post

Thanks for yr reply SRNET
Yr comments are interesting as it wouldnt work until I made an invertor.
It must have been a series of coincidents but the AXE027 is Kaput.
I tried it on a picaxe OM2 It wouldnt recognise it but the old serial cable was ok. I will have to get a new one
Jeff
 
Print this page


To reply to this topic, you need to log in.

The Back Shed's forum code is written, and hosted, in Australia.
© JAQ Software 2025