OSCSYS / brewtroller

BrewTroller Open Source Brewing Control System
9 stars 15 forks source link

Increase serial baud rate #19

Open mattreba opened 9 years ago

mattreba commented 9 years ago

Current baud rate of 115200 has a 3.7% error rate on the 16MHz MCU. The maximum speed supported is 1,000,000 (1Mbps). However, if debugging in the Arduino IDE it is limited at 250,000 bps. My vote is to use 1Mbps and if needed developers can use a external terminal application or drop the Serial baud rate to 250000 during debugging.

AllanMar commented 9 years ago

I suppose I don't feel strongly either way, but why not just use 250,000. (0% error). I don't really know what we need the extra speed for?

mattreba commented 9 years ago

Even though the hardware serial port has a buffer (64 bytes) the Serial print/write commands are blocking. The Status command (a) is used to provide a current data snapshot of the system. This response is about 200 bytes long. It takes 17 ms to transmit this response. Increasing the baud rate to 250K reduces this to 8ms. At 1Mbps this is around 2ms.

The I2C communication used for the BTnic module is also blocking and limited to a 100kHZ bus speed. Using a Serial connection at 1Mbps gives more time back to the brewcore loop to process core brewing logic.

AllanMar commented 9 years ago

I'm not a big fan of giving up on the BTNIC just yet. Seems like quite a waste of hardware, and then have to add a Pi as well. As I said, i don't feel strongly on BAUD rate either way.

Regarding I2C, as Ive mentioned before I think the protocol should be binary (and lighter). As much as it's convenient should probably remove the program names from the status command. It's significantly more difficult but I ideally would like to see the BT only transmit changes to the BTNIC and have the BTNIC cache the values (external SRAM on DX?)

mattreba commented 9 years ago

I have no intent of giving up on I2C Ethernet. The BTNIC protocol supports both the I2C and serial buses and this issue simply addresses getting the maximum throughput from the serial option.

On Wed, Jul 15, 2015, 5:35 PM AllanMar notifications@github.com wrote:

I'm not a big fan of giving up on the BTNIC just yet. Seems like quite a waste of hardware, and then have to add a Pi as well. As I said, i don't feel strongly on BAUD rate either way.

Regarding I2C, as Ive mentioned before I think the protocol should be binary (and lighter). As much as it's convenient should probably remove the program names from the status command. It's significantly more difficult but I ideally would like to see the BT only transmit changes to the BTNIC and have the BTNIC cache the values (external SRAM on DX?)

— Reply to this email directly or view it on GitHub https://github.com/OSCSYS/brewtroller/issues/19#issuecomment-121757277.