Asked
Resolved Resolved by ptp!

Sendserial Doesn'T Work Correctly

I'm doing some experimentation sending  a serial message ( 115200 baud rate) to ezbv4. The project sends  a packet of 10 bytes every 100 mS.  The packet is not always being sent every 100 mS, but  very often it is not sent, as you can see in this oscillogram. (each pulse you see is the 10 byte packet) . The're correctly spaced by 100 mS , but many are missing.

User-inserted image

 C

Can somebody explain what's going on ??


Related Hardware EZ-B v4

ARC Pro

Upgrade to ARC Pro

Unleash your robot's full potential with the cutting-edge features and intuitive programming offered by Synthiam ARC Pro.

PRO
USA
#9   — Edited

Please try this script (verbatim)

repeat($x, 1, 16, 1)
  SendSerial(D0, 115200, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9) 
  Sleep(2000)
endrepeat

Please count the number of the packages and time between them

After try this one (verbatim):

repeat($x, 1, 16, 1)
  SendSerial(D0, 115200, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9) 
  Sleep(100)
endrepeat

Please count the number of packages and time between them

Please post your findings

PRO
USA
#11   — Edited

@DJ: I know. I don't want to introduce another "variable" (i.e. javascript vs EZ-Script speed) to the reported problem. In 2016 I've explained the issue, Leonardo is still not understanding the issue, so I'm doing baby steps.

#12   — Edited

@Lenny.... Try what ptp suggests in post #9... If script #1 works with a sleep(2000) but script #2 does not work (dropping packets) with a sleep(100) then you have your answer... If it were me I would try using the "hardware" uart instead of "software" sendserial... If that didn't work either I then would learn JavaScript... FYI based on this thread alone I will be personally taking the time to learn JavaScript....

#13  

Hi guys. Test asked by PTP done. Even sending the packets every  2000 mS, many packets are not sent !... Packets themselves are correct, , but   they don't repeat well, some are skipped, no matter what is the repetion rate (2000,1000,500,100, etc.) . If someone had an oscilloscope , he might see with his eyes what happens.

I think it depends on the long time required by the ezb script to execute the  repetition.  For this now java is recommended by DJ. DJ says  "ezb isn't good for this stuff".  java script should be better.

PRO
USA
#14   — Edited

@Leonardo46:  You wrote:

Quote:

many packets are not sent
I only asked 2 simple questions

  1. how many packets, did you get 16 packets ? Yes / NO
  2. The timings between the packets ?
PRO
USA
#15   — Edited

Sorry to insist but I mentioned the problem in 2016, and you didn't see the connection. So before adding more variables Uart vs SoftwareSerial, or EZ-Script vs Javascript, I want you to understand the problem without missing steps (Wrong conclusion / Facts)

#16   — Edited

Sorry to PTP and others.  I couldn't see the pulses . They are too narrow to be detectable in a  time  interval of 2x16 =32 seconds ! I only saw some ones. So I used, for the 2000 mS script , simply a LED, and  no pulse was lost. Timing between pulses and inside the packets was correct. For the 100 mS script  i used the oscilloscope, and 8-9 pulses were always lost, in a random way, as i had seen in previous tests. The spacing between them was variable in a random way, around 100 mS, and,  inside the bytes,  timing was random as well. My question is solved . Thanks everybody.  PTP solved.