Problem with serrxd timeout on M2 processors

Hi All,

I haven't been able to get the optional timeout for the serrxd command to function correctly on any of the M2 processors. The following code works as expected with a 20X2, but all the M2 processors seem to skip right past the timeout (and fail to update the variables correctly).

Code:
' === TimeoutTest.bas ===============


' === Directives ===
    #com 7
    #picaxe 20M2
    #no_data
    '#no_table   ' un-comment for 20X2
    #terminal 9600
    
' === Begin Main Program ============
setfreq m8


do
  b0="*":b1="*":b2="*":b3="*"
  sertxd ("Test: ")  
  serrxd b0
  serrxd [4000],b1,b2,b3  
  sertxd (b0,32,b1,32,b2,32,b3,cr,lf)
  wait 1
loop
Every time I send a single character (e.g., "z") to a 20X2, the Terminal Window displays "z***" after a brief delay, which is what I would expect. However, for all the M2 processors, it works correctly the first time through the loop, but all subsequent attempts result in no delay at all, and the Terminal Window displays "****".

Also, various other inputs (of 2, 3 or 4 characters) produce the expected results with a 20X2 processor, but the M2 chips seem to be ignoring the timeout altogether (and not receiving the characters I sent them); they immediately send back the default "*" for each variable.

If anyone can clarify what's happening, I would appreciate it!

Thanks... Ron
 

Technical

Technical Support
Staff member
This a bug - we will fix the compiler for the next software release.

In the mean time if you do a dummy very long timeout on your first serrxd then it should work as expected

Code:
do
  b0="*":b1="*":b2="*":b3="*"
  sertxd ("Test: ")  
thisline:  
  serrxd [65535,thisline],b0
  serrxd [4000],b1,b2,b3  
  sertxd (b0,32,b1,32,b2,32,b3,cr,lf)
  wait 1
loop
 

zebulon

Member
This a bug - we will fix the compiler for the next software release.
Hi Technical,

I got the same timeout problem with the serin function.
Look at the code below :

Emission:
Code:
serout  4, N1200, ("CAPT", 1, B0, B1)
Reception :
Code:
serin [2000, erreur], C.6, N1200, ("CAPT"), numero_capteur_low, temperature_lsb, temperature_msb
The SERIN never get into the ERREUR timeout function when a timeout occurs and the SERIN function stay waiting indefinitely.

How could I temporarily solve this bug ?

When will the next compiler release be available ? Thanks in advance.

Guillaume
 

hippy

Technical Support
Staff member
The SERIN never get into the ERREUR timeout function when a timeout occurs and the SERIN function stay waiting indefinitely.
Which PICAXE are you using ? Is this a wired-connection or wireless ?

I tested on a 20M2 and the timeout occurred as expected.
 

7cory7

Member
I get the same problem using that code on an 18m2. I just got some 28x2's I,ll try it on this weekend. Serrxd works but serin and HSERIN will not.

Mine is a wired setup.
 

Technical

Technical Support
Staff member
This is all getting a bit mixed up - the compiler bug is *only* on serin/serrxd commands *without* a timeout, as with the very first example. Any other issue is different and most likely a wiring/communication issue - as hippy already says the timeout of the second example works fine on 20M2.


I get the same problem using that code on an 18m2. I just got some 28x2's I,ll try it on this weekend. Serrxd works but serin and HSERIN will not.

Mine is a wired setup.
On an 18M2 serrxd and serin are actually the same command, just processed by the compiler differently! So if one works the other should, as the firmware in the chip is exactly the same bit of code.
hserin is completely different and does not support timeouts on M2 parts.
 

zebulon

Member
Hi hippy,
thanks for the reply.
A 08M is used for wireless emission, sending temperature.
A 18M2 is used for wireless reception, displaying the data on a 4x20 LCD.
The firmware of the 18M2 is 2.B.

Is there a solution ?
 

7cory7

Member
My Bad. Your right it has to do with the timeout. I'll have to look closer next time.
Thanks Technical!
 

hippy

Technical Support
Staff member
With wireless reception, using dumb modules ( like RFA001 for 433MHz ), RF noise will keep the SERIN continually active so timeouts will never occur.
 

zebulon

Member
@hippy,

Ok, I understand and agree with you.
Before using wireless, i used wired connection, and if i remember well, there was no problem.

Is there a solution with wireless connection ? I'm using 433 modules.

Thanks in advance,
Guillaume
 

zebulon

Member
Thanks hippy.
I will use a 08M to filter the received packets and send them back to the 18M2. So I can use a serin timeout on the 18M2 and if the 08M didn't receive anything, then the 18M2 serin timeout could occurs.

Guillaume
 
Top