Pyserial 1 second delay

Hello,

I am not quite sure if this is the place to put this question, but I am having issues with using pyserial to send commands to my arduino GIGA R1. I am trying to rapidly send USB commands (aiming for 1 command every 0.3 seconds) via string over USB connection that looks like this "i2,xxxx,xxxx,xxxx,xxxx" to change the output on an i2c DAC. I know I can change the DAC pretty rapidly in a loop solely on the R1 (rapidly switching between 2 values every 40ms) and the code takes 1ms to execute when a command is received via Serial monitor. However, when I try to do the same via pyserial, I have to set a delay of just over 1 second for it to work. If less than that, the DAC just wont change. Is this caused by code under the hood of how pyserial works? Or is there something else going on? Baud is set to 250000, buffer on the COM port in device manager is reduced to 1, and the baud rate is also at the max for the com port

Please keep in mind that we are not a free design or code-writing service. We’re more than happy to help with your design or code, but we need you to make an initial attempt. Please design and write your code, then post it along with an explanation of what’s not working properly. There is also a for hire section if you want to pay for it.

Is this a school project? What we need you to do is:

  1. Show Your Work First: Before asking for assistance, make an attempt to design or write the code yourself. Share your work along with details about what isn’t working. That includes a preliminary schematic that you drew.

  2. Provide Clear Documentation: Since we can’t see your project, share an annotated schematic (best) or a clear drawing of your setup. Clear Pictures are welcome, but avoid using Fritzing diagrams as they are wiring diagrams, not schematics, and are not ideal for troubleshooting.

  3. Include Technical Details: If there is specific hardware involved, include links to technical information. There are often many versions of similar components, so precise details are essential. Many times the processor is assumed, please state which one and post a link to it.

  4. Reference Resources: For additional help, check out useful links and tutorials: Useful Links on Arduino Forum. Of course one of the better sources of information (in my opinion) is the Arduino Cookbook. Skim it cover to cover and stop on any project that interests you.

Impossible to say without seeing your sketch code and Python script.

There may be some wrong input parsing or buffering or timeouts or wrong line endings in place.

I've written a small tutorial on interfacing with Python. See Two ways communication between Python3 and Arduino

that feels like a timeout

If you create a Ser##ial object without specifying the timeout parameter, then reads are blocking and will wait indefinitely until enough data arrives. if you have copied some code from somewhere else, may be

serial.Serial(
    port=None,
    baudrate=250000,
    bytesize=EIGHTBITS,
    parity=PARITY_NONE,
    stopbits=STOPBITS_ONE,
    timeout=None,    # <<==== ⚠️⚠️what do you have there ??
    write_timeout=None,
    inter_byte_timeout=None
)