ole00 / afterburner

GAL chip programmer for Arduino
154 stars 42 forks source link

Change serial speed. #33

Open TheEccentricGenius opened 1 year ago

TheEccentricGenius commented 1 year ago

So I've tried 57600, and it's pretty hard to get it to work reliably.

I would prefer 115200, only my MCP2200 serial chips work at 57600. I think it would be easier to use 115200, all UNO boards have to be accurate enough to upload at that speed.

Any reasons for not going with 115200(So I'm not left in the dark)?

ole00 commented 1 year ago

Not quite sure why your MCP2200 works only at 57600 - do you mean in general with any software or specifically with Afterburner? If you mean with Afterburner, then the baud rate is hardcoded in the UNO sketch and the pc program - both must have the same baud rate in order to have serial connection. Baud rate of 115200 seems to be the worst on UNO (16MHz crystal clock) with error rate -3.5%, while 57600 has error rate 2.1% (also not great). The best baud rates on Arduino UNO seem to be 9600 or 19200 or 38400 (0.2% error rate). Try them out - it might work better for you. You'll need to change and upload the Afterburner sketch ( check for Serial.begin(57600)) and recompile PC program (change baud rate in src_pc/serial_port.h - the code there is specific for Windows and Linux, so to be sure change all occurrences of 57600 to your desired baud rate).

Edit: looking at the datasheets of Atmega328p and mcp2200 the best option for your specific case seems to be 38400 as it has 0.2% drift on UNO and 0.16% drift on MCP2200, giving you difference of 0.04% drift error. baud_rates

Edit2: Actually, the previous information in my Edit is wrong, because of the way those 2 datasheets calculate the error :) One calculates the error rate as Desired/Actual (MCP), the other one as Actual/Desired (UNO). So with 38400 you'd get 0.36% cummulative error. The best seems (in your case) 9600 or 19200 with 0.2% error.

TheEccentricGenius commented 1 year ago

Sorry, only the MCP2200 chips work with the 57600 baud rate....And they still a bit glitchy.

I am also using the 8MHz internal clock....which is yet worse for 57600 baud. I can't explain the 115200 baud rate....all my ATmega328P's run with that baud rate without a problem.

I ended up changing the baud rate to 115200 which is rock solid reliability. Thanks for the info....Sorry if I seemed a little "off" the other day, I was really frustrated by it all.