Skip to content

Arduino Mega2560 - RX pin lose bytes #20

Closed

Description

@zxia545

I have config 15 Analog pin to be analog input pin and then I found sometime Arduino did not received correct message that I sent from Python. (I have verified the message send from python is correct)
It seems like a problem with continue reporting back analog pins and digital pins from TX back to python. The RX sometime will lose few bytes.

So, I used oscilloscope to monitor RX pin from Arduino, and sending [0x91, 0x40, 0x01] and [0x91, 0x00, 0x01] each 0.5 second. But sometimes it will drop the last or last two bytes.
MicrosoftTeams-image (2)

This problem can be solved by changing the baud rate from 115200 to 9600, but then for those pins be config as analog input become a problem since the baud rate is dropping. Another way to hide this issue is only setting one or two pins to be analog input pin.

I also try to use an external USB to TTL converter to bypass this issue, it kind of fix the RX issue but the data sending back from Arduino to python is not correct at using the original USB to TTL converter micro in Arduino.

Activity

  1. MrYsLab commented on Nov 24, 2022

    @MrYsLab
    Owner

    Thanks for reporting tthis. I don't have the resources to run that number of analog inputs, but this suggestion may solve the issue. You can change the analog input scan rate by calling set_analog_scan_interval The default scan rate is 19 ms.

    Please let me know if this solves the issue.

  2. zxia545 commented on Nov 24, 2022

    @zxia545
    Author

    Thanks a lot, but I am currently using the pymata4 with firmata-express :(.
    So can I call set_sampling_interval in pymata4 to achieve the same result? And what if disable all the analog input pins polling that Arduino only sends analogRead value when receiving an inquiry for an analog pin (a command send from pymata4)?

    Also wondering why you decided to use the polling mechanism for reading analog input and digital input. Is it because you want to increase the speed of the python reading value of analog and digital pins?

  3. Repository owner locked and limited conversation to collaborators on Nov 24, 2022
  4. converted this issue into a discussion #21 on Nov 24, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions