My new ERF boards, I can't get them to talk!! "NUBE alert!!,,enter at your own risk!"

JPU

Senior Member
My new ERF boards, I can't get them to talk!! "NUBE alert!!,,enter at your own risk!"

Hi All

I have bought two ERF boards that arrived today!!. I have connected them to a power source and I have a heart beat on the LEDs. I have one 08m2 with this program


init: pause 500
main:
serout c.0,n2400,(254,1)
serout c.0,N2400,(254,134)
serout c.0,n2400,("hello world!")
pause 500
serout c.0,n2400,(254,192)
serout c.0,n2400,(253,1)

GOTO MAIN
end


I have the c.0 pin connected to the Rx on the first ERF board. The second ERF is connected via the Tx pin to the serial in pin on my OLED board that I have purchased. The OLED has a AXE133 board attached. I am able to connect the OLED board to my PICAXE directly to c.0 and I get the display "hello world", however as soon as I connect OLED to the 08m2 via the ERF modules, nothing happens. I have 2 heart beats and have connected the DTR led on both ERF boards. There is some flashing? but there is no dipslay on the OLED. Ie the serial data is not getting through.

Any help with this one would be great....I cant really find much literature about the ERFs except a PDF that mainly describes ERFs and PICAXE programming. ( RFA020.pdf and http://www.picaxe.com/docs/RFA021.pdf)

Thanks in advance..
 

jedynakiewicz

Senior Member
I think that you will find that the default speed is n9600 - not n2400 - see the third page of the docs that you reference.
I don't think that you can connect the second ERF to the OLED board without changing the settings to n2400 by means of AT commands - which are not yet documented by PICAXE but there has been talk of having a wizard in a future version of PE that will set these for you.
 

JPU

Senior Member
I think that you will find that the default speed is n9600 - not n2400 - see the third page of the docs that you reference.
I don't think that you can connect the second ERF to the OLED board without changing the settings to n2400 by means of AT commands - which are not yet documented by PICAXE but there has been talk of having a wizard in a future version of PE that will set these for you.
I thought it was something like that.

However, I tried using n9600 and the serout command rejected it!!!

Without good documentation this is going to be hard.
 

JPU

Senior Member
Yes... You'll need to set that via direct connection to the PICAXE, then connect it through the ERF modules :)
Sorry, what do mean? I tried changing the code shown above and the pcaxe programmer rejected the syntax. That was as ar as in could get. Should I change the oled firmware? Or is there a way to change the baud rate via the above program. If so, please could show me the syntax.

Thanks.
 

srnet

Senior Member
However, I tried using n9600 and the serout command rejected it!!!
Can you help us to help you ?

What do you mean by the 'serout command rejected it' ?

Give us a clue, any error messages, what happened ?
 

Jamster

Senior Member
Sorry JPU, I deleted my post because it didsn't make much sense: now it makes even less sense...

I think you need to use the setfreq command to allow you to use a baud of 9600, that might be why I't rejecting it :)
 

JPU

Senior Member
Thanks Jamster for the reply

I tried this :- init: pause 500
main:
serout c.0,N9600_8,(254,1)
serout c.0,N9600_8,(254,134)
serout c.0,N9600_8,("hi world!")
pause 500
serout c.0,N9600_8,(254,192)
serout c.0,N9600_8,(253,1)

GOTO MAIN
end




After srnet directed me to manual 2 page 208 but still no luck. No comms and now garbage when I connect the OLED directly to the picaxe.

I really need instructions and can not believe they sell these with so little instruction!

I know its my nube-ness at fault but I could do with some sample code to get this thing going!!

Ill keep trying,,,,,

Thanks,,,its late!
 
Last edited:

john2051

New Member
Hi jpu, I've just looked at the firmware for the axe133, and it says 2400baud.
if i were you, i would forget the commands for now, and see if you can get the
"hello world" to send and display ok.
All the information you need is either in the manuals, or in the modules datasheets.
Sometimes it takes alot of looking, but thats part of learning.
Let us know how you get on
regards john
 

JPU

Senior Member
Hi John

Yes I noted the 2400 baud rate in the firmware. I've been reading a lot and I think I need to figure out how to adjust the erf module to communicate at 2400. However there aren't any pointers in the data sheet for the erf.

Is ths an at command?

Added....I've just read is an atbd command. That's atbd 1 to make it 2400. How do I set the erf that is receiving though, to 2400 as its not connected to the 08m2??? Anyone?

Thanks.
 
Last edited:

jedynakiewicz

Senior Member
After srnet directed me to manual 2 page 208 but still no luck. No comms and now garbage when I connect the OLED directly to the page.

I really need instructions and can not believe they sell these with so little instruction!

I know its my nube-ness at fault but I could do with some sample code to get this thing going!!

Ill keep trying,,,,,

Thanks,,,its late!
I feel your frustration...
I am afraid that you are missing out on setting the speed of the 08M2 chip; you need SETFREQ M8 to bring the 08M2 chip up to a speed at which it can produce n9600. But the problem that I mentioned in an earlier post remains; the OLED has an 18M2 chip on board that is set to communicate at n2400 baud but your ERF board is sending its serial output at n9600 and therefore the AXE134 cannot receive it. That also explains why you are getting garbage when you connect the OLED directly to the PICAXE - the baud rate is now wrong for the OLED.

The ERF board CAN be reconfigured to a different baud rate but this requires the use of "modem commands" - these are so-called AT commands and are not yet documented specifically for PICAXE. The ERF board has to be triggered into responding to these and reconfiguring itself, rather than just sending the data on as serial comms, by sending three plus signs (+++) within one second and then waiting for the ERF to respond. The AT commands that reconfigure the ERF board can then be sent. This really needs to be done by a terminal program, although it is possible to do this with a PICAXE routine.

I suppose that you could also try and patch the OLED firmware (which is published by RevEd) to a higher baud rate; I took a quick look at the code and I don't initially see any major issues doing that, but perhaps Technical would confirm whether this is the right track to take.

Basically, with the depth of experience that you appear to have with PICAXE, I would suggest that you start off with the ERF modules by getting them to communicate between two PICAXE chips. Once you have, for example, remote control of an LED via the ERF modules, you could then start to advance your knowledge and understanding.

What you tried to do seems logical; take a PICAXE chip, a PICAXE-driven OLED and two ERFs and see if they talk to each other... How frustrated you must be in finding that the story is actually a lot more complicated than that! I am sure that the documentation will be expanded by RevEd in the future.
 

JPU

Senior Member
Thanks for post "Jedy...."

I appreciate your comments. I had worked that out and realised that I needed to sync the baud rates...

So are you saying that setting the erf baud rates to 2400 is at present not possible due to the lack of documentation. I believe the command is ATBD 1. But how do I tell the erf??.

Thanks.
 

HertzHog

Member
From the first post, I wonder if you have the Rx and Tx the wrong way round? You seem to be sending on the receive pin and vice versa. HertzHog.
 

srnet

Senior Member
I suppose that you could also try and patch the OLED firmware (which is published by RevEd) to a higher baud rate; I took a quick look at the code and I don't initially see any major issues doing that, but perhaps Technical would confirm whether this is the right track to take.
If you change the 18M2 OLED code to run at 32Mhz, it should allow serial operation at 4800baud.

With the OLED at 9600baud, it can start dropping characters. It really depends on the gaps between each individual character.
 

JPU

Senior Member
If you change the 18M2 OLED code to run at 32Mhz, it should allow serial operation at 4800baud.

With the OLED at 9600baud, it can start dropping characters. It really depends on the gaps between each individual character.
But the problem remains that the ERF is running at 9600. I think it is that that I need to change the speed of.

I am hoping technical might have the answer today!

Thanks
 

hippy

Technical Support
Staff member
The command to set 2400 baud on an ERF is "ATBD 960"; the 960 is the baud rate of 2400 expressed in hexadecimal.

In addition to ATBD, an ATWR command must be issued to save the setting to the the ERF module itself so it is restored at power-on. An ATAC command can be issued to activate changes immediately.

A Wizard that generates PICAXE code to configure an attached ERF module has been developed, is currently being tested and is being prepared for packaging and release.
 

JPU

Senior Member
Thanks Hippy for that!!

Can you give me the code with correct syntax, I need to put into my program to initiate the command. ie to set the baud rate on the two ERFs

I am not being lazy but a so I can just cut and paste from here to the PICAXE programmer. I really am a nube and if I see the code I will then be able to understand it.

Any ideas how long the wizard will be before release.

Regards

JPU
 

hippy

Technical Support
Staff member
The Wizard is undergoing testing and will be released as soon as that is complete.

Unfortunately it may not be possible to control an AXE133/AXE134 directly from an ERF module as easily as may be desirable. Because of its design the AXE133/AXE134 needs time between bytes received to do its processing and this time is not provided for by the ERF modules; bytes received are output back-to-back.

If bytes are sent one at a time from a PICAXE then this works satisfactorily but precludes sending more than one byte per SEROUT / HSEROUT command. In addition, the sending ERF buffers data sent to it then passes these on to the receiver as a whole, so each byte sent requires a delay until the ERF has sent the byte onwards. The delays and buffering can be minimised but there is still a requirement for some delay after each byte to be sent.

The most appropriate solution may be to use a PICAXE X2 and high-speed serial background receive to receive the ERF data and forward that on to the AXE133/AXE134 with suitable delays between bytes.
 

ciseco

Senior Member
The most appropriate solution may be to use a PICAXE X2 and high-speed serial background receive to receive the ERF data and forward that on to the AXE133/AXE134 with suitable delays between bytes.
Hehehe, beat me to it.
 

BeanieBots

Moderator
The most appropriate solution may be to use a PICAXE X2 and high-speed serial background receive to receive the ERF data and forward that on to the AXE133/AXE134 with suitable delays between bytes.
or cut out the middle man and use an X2 to background receive AND control the display direct.
 

JPU

Senior Member
Hi

Thanks for your replies. For the final application I only require the sending of 1 byte of information at a time, so this is not a problem. Is there any chance you can send me an example of the code needed to set the appropriate baud rates for both ERFs

Thanks

JPU
 
Last edited:

hippy

Technical Support
Staff member
The following code should set a module to 2400. Once programmed do not remove power from the module, or it will return to its default N9600 baud rate.

The code sends blind with no error or confirmation checking so we would advise against using this mechanism and recommend waiting for the Wizard which does check results and reports progress as configuration is performed.


Code:
#Picaxe 08M2
#Terminal 9600
Symbol TX = ?.?
SetFreq M8
Low    TX                              : Pause 4000
SerOut TX, N9600_8, ( "+++"          ) : Pause 4000
SerOut TX, N9600_8, ( "ATBD 960", CR ) : Pause 2000
SerOut TX, N9600_8, ( "ATAC",     CR ) : Pause 2000
SerOut TX, N2400_8, ( "ATDN",     CR ) : Pause 2000
SerTxd( "Done" )
End
 
Last edited:

JPU

Senior Member
Hi

Thanks I tried this code:
Code:
#Picaxe 08M2
#Terminal 9600
Symbol TX = C.0

PAUSE 4000


SetFreq M8
Low    TX                              : Pause 4000
SerOut TX, N9600_8, ( "+++"          ) : Pause 4000
SerOut TX, N9600_8, ( "ATBD 960", CR ) : Pause 2000
SerOut TX, N9600_8, ( "ATAC",     CR ) : Pause 2000
SerOut TX, N2400_8, ( "ATDN",     CR ) : Pause 2000
SerTxd( "Done" )

pause 500

main: 
serout c.0,N2400_8,(254,1)
'serout c.0,N2400_8,(254,134)
'serout c.0,N2400_8,("!")
pause 500
'serout c.0,N2400_8,(254,192)
'serout c.0,N2400_8,(253,1)

GOTO MAIN
end
However, no luck. I remend out some lines to keep the transfer low. As you can see the 254,1, should just clear the LCD screen. It doesn't.

If anyone has a suggestions, that would be great, (please don't say wait for the wizard again). I did change the original "Symbol TX = ? . ?" that Hippy inserted, as I assume this should have been as I have inserted it. Is this wrong perhaps?

Thanks

JPU :(
 

hippy

Technical Support
Staff member
I suspect the problem is you are programming the sending ERF to 2400 and not the receiving ERF that has to be programmed and then be connected to the AXE134 ( without removing its power ).

Also "serout c.0,N2400_8,(254,1)" won't work; as noted only one byte at a time can be sent and each byte needs a pause after it if sending to a direct ERF to AXE134 connection.
 

JPU

Senior Member
I thought that the code you sent me would allow me to program both ERFs. ie the ERF connected to the 08m2 would also reprogramme the receiving ERF to function at 2400. I assume that I thought wrong?

So do I need to run this code though both ERFs individually, as I could copy this code to the OLED picaxe ie the 18m2s firmware to achieve this,,,,couldn't I??

If I need to send only one bit of information, do you have a suggestion of anything I could send to the OLED. All I want to do is create and check the link between the two devices at this stage and manipulate the OLED in anyway!. Once I have done this, I can then concentrate on sending the serial data in the background to the OLED as this is something I have yet to learn I'd rather get the ERFs connected first. (since I have already began the mission, I'd like to finnish;))

Cheers

JPU
 
Last edited:

hippy

Technical Support
Staff member
The receiving ERF has to be programmed separately as changing the baud rate on the sending ERF does not change the baud rate on the receiving ERF. The AXE134 code can be modified to set the receiving ERF baud rate.

( A URF to ERF setup is different; changing the baud rate of the URF will change the baud rate on the ERF )

The sending ERF does not have to have the same baud rate as the receiving ERF so does not have to necessarily have to have its baud rate changed from the default N9600. You can think of it like a warehouse where the rate of things going in can be entirely different to the rate things are taken out. The things will get from the in door to the out door regardless. It can however make things easier to understand if both baud rates are kept the same and it's usually best to use a sending baud rate that is slower or the same as receiving baud rate.

To send bytes one at a time you simply need to split the SEROUT commands so they each send only a single byte and add a delay. The following should repeatedly clear the LCD then print "Hello World" on the first line a character at a time -

Code:
#Picaxe 08M2

Symbol TX = C.0

SetFreq M8
Low    TX                              : Pause 4000
SerOut TX, N9600_8, ( "+++"          ) : Pause 4000
SerOut TX, N9600_8, ( "ATBD 960", CR ) : Pause 2000
SerOut TX, N9600_8, ( "ATAC",     CR ) : Pause 2000
SerOut TX, N2400_8, ( "ATDN",     CR ) : Pause 2000
Do
  SerOut TX, N2400_8, ( 254 ) : Pause 1000
  SerOut TX, N2400_8, (   1 ) : Pause 1000
  SerOut TX, N2400_8, ( 254 ) : Pause 1000
  SerOut TX, N2400_8, ( $80 ) : Pause 1000
  For b0 = 0 To 10
    LookUp b0, ( "Hello World" ), b1
    SerOut TX, N2400_8, ( b1 ) : Pause 1000
  Next
Loop
Added : I note that you are using C.0 to the sending ERF. This is not a good idea as C.0 is also the download Serial Out pin and will output data during every download to the sending ERF and thus also the receiving ERF. This is likely to confuse the AXE134 and cause all sorts of problems. It would be recommended to use a different output pin to the sending ERF.
 

hippy

Technical Support
Staff member
changing the baud rate on the sending ERF does not change the baud rate on the receiving ERF.

( A URF to ERF setup is different; changing the baud rate of the URF will change the baud rate on the ERF )
There's a potential "gotcha" when using ERF to ERF to communicate between PICAXE and a URF is added to the mix for monitoring or for testing. Assuming two ERF communicating at 2400 baud ...

PICAXE ---[2400]---> ERF - - - > ERF---[2400]---> PICAXE

That will work just fine.

Add a URF and both ERF will be set to the URF baud rate, so the URF must be set to 2400 baud. If the URF is set to 9600 baud say, the ERF will too, so the sending ERF won't understand the data sent to it from the sending PICAXE at 2400 ( the ERF now expects 9600 ), and the receiving PICAXE won't understand data received by the receiving ERF at 9600 baud ( the PICAXE expects 2400 ). All modules have to be set to 2400 baud.

This means that the ability to send to an ERF at one baud rate and receive at another cannot easily be achieved with a URF in the mix - For example ...

PICAXE ---[9600]---> ERF - - - > ERF---[2400]---> PICAXE

Whatever the URF baud rate, both ERF will be set to the same and the desired operation will fail either because ( URF at 2400 baud ) the sending ERF is expecting 2400 baud but the sending PICAXE is using 9600 baud, or ( URF at 9600 baud ) the receiving ERF is delivering 9600 baud data when the receiving PICAXE is expecting 2400 baud.

It should also be noted that only ERF with PICAXE Firmware will have their baud rates changed when the URF baud rate changes. ERF with standard firmware and XRF modules will not.

The bottom line is that it's best to use a single baud rate for both sending and receiving and set all modules to use that. Do that and the esoteric issue described here should not be a concern.
 

JPU

Senior Member
Ok, I have tried all that and frustration here in Wales is now at an all time high!!

If have reverted to just simply trying to get these things to talk to each other and control an LED.

here is the TX code for one picaxe 08m2

Code:
#Picaxe 08M2

Symbol TX = C.0

SetFreq M8
Low    TX                              : Pause 4000

Do
  
  For b0 = 0 To 10
    LookUp b0, ( "01010101010111101010101010101010100101010" ), b1
    SerOut TX, N9600_8, ( b1 ) : Pause 1000
  Next
Loop
and here is the other for the rx picaxe

Code:
#Picaxe 08M2

Symbol RX = C.1
HIGH 2
PAUSE 500
LOW 2
PAUSE 500
HIGH 2
PAUSE 500
LOW 2


SetFreq M8


main: 
DO ; start a loop
serin rx,N9600_8,b1 ; receive serial value
 
IF B1=1 THEN HIGH 2
ELSE  b1=0 LOW 2
END IF
B1=2


LOOP

It doesnt work. Im using the two erf modules.

Please can anyone see where I have gone wrong in the code. I am trying to use the default 9600 rate..

Thanks
 
Last edited:

hippy

Technical Support
Staff member
As with all testing, it's recommended to start with the very simplest of code ...

Code:
Transmitter:
SetFreq M8
Do
  SerOut TX, N9600_8, ( "U" )
  Pause 2000
Loop
Code:
#Terminal 9600
Receiver:
SetFreq M8
Do
  SerIn RX, N9600_8, b0
  SerTxd( b0 )
Loop
Do you have a URF module ? If so start with just transmitting via an ERF and check if you see anything received by the URF.

Check the ERF module is wired correctly, you haven't got the TX/RX pins crossed over, check CTS is pulled to 0V.

Put some distance between the modules as they may not work if too close.

Perhaps post circuit diagrams and/or photos of your setup so what you have can be checked.
 

JPU

Senior Member
Hi Hippy

I pasted and copied your code but once I went to program the picaxe it came up with some pin errors etc etc,,,, Im beginning to lose interest now, and the will to live.

Can you take a quick look at this code

Code:
main: 

DO ; start a loop
serin rx,N9600_8,b1
pause 500 ; receive serial value
 
IF B1=1 THEN low 2
ELSE  B1=0 high 2
END IF
B1=2


LOOP
I have a simple question, When the first bit of data is read ie 0 or 1 . does the serin command wait until the next peace of data comes along before advancing or does it simply read whatever is at the pin and interpret it as new data regardless of whether it is or not. Difficult to put across what I mean!!! I hope you understand.

Regards

jpu
 

Jamster

Senior Member
You need to change the "TX" and "RX" in Hippy's code for your layout... As we say, schematics would be usefull...
 
Top