I'm sorry you were caught by the edges, Max performance is defined as the ragged edge. Just like the immortal words of President Reagan: All this could have been avoided if the documentation was correct and accurate. We could have chosen a different processor and had different hardware developed around that instead. So now we have our prototype which is severely crippled because of this fact. Base a prototype around information read off the Arduino website, and find its not quite as it was made out to be. May seem harmless but its cost us dearly. It needs further clarification and notes added to the page. I added a few lines of code to the existing SoftwareSerial Library and renamed it SoftwareSerialParity. While it might be true it is capable of 115200, it is under very specific and restrictive conditions, and having it state "115200 is OK", I believe is inaccurate. I needed a way to communicate with a PLC using 38400, 8, ODD, 1 Serial protocol. We made initial hardware decisions based on what we researched, and then find in practice things like this SoftwareSerial issue - its disappointing really, and has been a large waste of money for us. Our company (mvandere and I work together) has been working on a new product based around the Leonardo, and we have spent thousands on development, with facts taken from the pages like SoftwareSerial. Obviously that isn't the correct answer to get things going properly, but I'm lost, how do you get SoftwareSerial working at 115200 (and gee the doco says "It is possible to have multiple software serial ports with speeds up to 115200 bps.", how?) Now the echo program runs at 115200 without errors. TIMSK0 = 0 // disable Timer0/millis Interrupt Now I'm no expert on AVR/Arduino (never seen the instruction set until today), but surely that means the 'millis' interrupt could/can stop serial receive at 115200?Īs an experiment I inserted this into my sketch To me this means there is no room for anything else to 'get in the way' at 115200. _rx_delay_centering = subtract_cap(bit_delay / 2, (4 + 4 + 75 + 17 - 23) / 4) įor 115200 this means _rx_delay_centering will be 1. we already wait for 1 bit time - 23 cycles, so here we wait for We want to have a total delay of 1.5 bit time. are 17 more cycles until the pin value is read (excluding the ISR vector table) until the first delay. and then 75 cycles of instructions (including the RJMP in the interrupt vector address and the old PC is pushed on the stack, interrupt flag is set, 4 cycles before the PC is set to the right I jumped inside the software serial library and found this, amongst the code // When the start bit occurs, there are 3 or 4 cycles before the It works fine with 0% errors at 57600, but I really need 115200. I wrote a sketch to simply echo what was received and at 115200 I get ~0.2% of characters being echoed incorrectly. I need to have 2 serial devices attached at 115200 and cannot get software serial to work reliably. The Serial Monitor or other Terminal emulator program will read from that USB COM port.Does software serial really work reliably at 115200 baud? You will need a TTL Serial-to-USB adapter (aka FTDI) on the selected pins to connect to the PC. Then use AltSoftSerial or NeoSWSerial for your debug statements. Unless you are using an ISP, you will have to disconnect the device to upload a new sketch over USB. In that case, I would suggest using Serial for the 115200 device. Although AltSoftSerial and SoftwareSerial allow that baud rate, they may not send/receive data correctly. If you could use a slower baud rate, you could keep your debug prints on Serial, and use either AltSoftSerial or NeoSWSerial for your device.īut if you have to use 115200, the only reliable choice is Serial. This can interfere with other parts of your sketch, other device communications, or with libraries. It disables interrupts for the entire time that a character is being sent OR received, and it cannot do both at the same time (unlike all the other serial choices). It works on any two pins, but it is very inefficient. It works on any two pins, but only at baud rates 9600, 1920. Only one instance is allowed, and it is must be used on one of the Input Capture pins (pins 8 & 9 for a Nano). The Nano only has Serial.ĪltSoftSerial, the best of the software serial libraries. On some Arduinos, there are extra HardwareSerial ports, called Serial1, Serial2, etc. Simply use the pre-defined Serial variable.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |