serrxd problem

Peter M

Senior Member
Hi all, I am trying to get comms to work between two picaxes using a crossover programming cable using serrxd and sertxd. one is an 08m2 the other a 28x2.

so the 08m2's default speed is 4800,n,8,1 and the 28x2 default is 9600,n,8,1 using these commands.
The manual says increasing clock speed to 8mhz, on the 08m2 will make its output run at 9600,n,8,1, (same as 28x2) yet when I up it to that freq the following fails??
at 4mhz an LED flashs once every second, and it replies back to the terminal as expected when the 25,25,n is sent from the terminal, so I would expect that to happen every half second at 8 mhz. but nada.?
yes I set the terminal to 9600 to match the new clock speed. no led heart beat, no reply. No doubt I am doing something wrong.

#Picaxe 08M2
#no_data
b4=101


setfreq 8 ;it works without this, but need it for 9600 baud


Start:
if pinc.3=1 then goto here ;test for programming exit
pulsout c.1,50 ;short pulse on Y led
serrxd [950,start],(25,25),b4 ;wait for data with qualifier Nos of 25,25,data

high c.2 ;light Green LED
sertxd("the value sent was ",#b4,13,10) ;send data back to terminal
pause 1000 ;wait a sec
low c.2 ;G LED off
goto start ;go wait for more data on programming pin


here:
high c.2 ;light Green LED
end
 
Last edited:

Technical

Technical Support
Staff member
Using the serrxd pin like this from another chip is likely to cause all sorts of issues with the first chip resetting as it thinks a 'new download' is coming. To avoid this you will need to add a 'disconnect' command right at the start of the program and make sure no data is sent until the disconnect command has processed.

If possible using serin/serout on a normal i/o pin would be a better solution.
 

Peter M

Senior Member
hi Technical, it works fine at 4mhz and yes I understand your point. all other pins are used, and these are already accessible from the outside of the case of the existing project.
the problem is that at 8mHz it stops doing anything.

supposedly the serrxd command does the disconnect. (I have to do a hard reset to reprogram it after the program has run)

I have tried adding a disconnect and it makes no difference.
 

Peter M

Senior Member
Figured it ...now works like a bought one :)

the line where i have setfreq, I have it as "setfreq 8". It should be setfreq m8

new I was being thick
 

inglewoodpete

Senior Member
Hi Peter, I noticed that you have not acknowledged the need for a "disconnect" command when using SerRxd. You do need to add it to your initialisation code before entering the main loop. Otherwise you will get spurious restarts.

(Another) Peter
 

Peter M

Senior Member
Hi Pete, according to the literature a serrxd command issues the disconnect as part of its setup. And that does seem to be the case, as I cannot download a new program without hard resetting the target picaxe.

I have now tried my (eeprom) read, sertxd (pic one) - (pic two) serrxd write (eeprom), and it works like a dream. All 255 values read from one and written to the other.

I had to put in a 6 mS pause in the loop on the transmit side to allow the receiving pic time to write the values and be ready to receive the next value. I checked all the written values by reading them back to the picaxe terminal. At 5mS it still had some errors, at 6 mS perfection, so I will probably go 7 mS for safety.
 

bpowell

Senior Member
From the SERRXD description:

The PICAXE chip normally constantly scans the serial download pin to see if a computer is trying to initialise a new program download. However when it is desired to use serrxd it is necessary to disable this scanning. This is automatic, and is effectively the same as issuing a disconnect command.
 

inglewoodpete

Senior Member
Hi Pete, according to the literature a serrxd command issues the disconnect as part of its setup. And that does seem to be the case, as I cannot download a new program without hard resetting the target picaxe.
Thanks for the update. I need to take the command manual to bed with me more often for some late night reading:).
 

Peter M

Senior Member
Pete :-O I'm sure you could find something better to do than that :) ....write more of that wonderful code you write and share for example.

In fact, the current project I am working on has snippets of such. The 28x2 I spoke of, is in an axe401 with an lcd with buttons shield. you wrote a sample code to initialise, read the switches, read n write scratchpad eeprom etc. . took me a little while to wrap my head around it, but I must thank you for what it has taught me. :)) and yes bits of it are in use!

the overall project is to reprogram values in some 14m2 based remote control night photography flashes I built some years back, at the time I programmed them with a binary readout on 4 leds, but it kind of does my head in trying to remember what does what. menus and values are all in binary. so my eventual plan is to program them in english on an LCD then to down load the values into eeprom.
so far I have managed to upload eeprom values from a test 08m2 (schoolies trainer board), modify them, and then download them back. next stage is to integrate that into the current flash systems.
 
Top