aa4cc / fpga-generator

1 stars 2 forks source link

Fix UART to withstand interference from output shield, change to software-controlled master mode #3

Closed ptrbroz closed 4 years ago

ptrbroz commented 4 years ago

Fixes problems that arise when the output shield's 16V is connected.

UART receiver used to interpret interference spikes as start bits of bytes, leading to infinite 0xf8 or 0x08 replies (meaning "received unknown code"). Fixed and tested that UART now withstands the spikes.

The jumpers previously used to determine master/slave mode (located on chaining shields) appear to pick up interference as well (when the 16V voltage is connected). This led to random switching between master mode and slave mode on the master generator, causing erratic output behavior (randomly changing duty cycles and phases).

As a solution, the master/slave mode is now determined by communication. All generators begin in slave mode, and 2 new commands were added - one to switch a generator into master mode and another to switch it into slave mode. Master mode is still indicated by the LED on chaining shield.

On receiving an unknown code byte when a code byte was expected, the generator no longer waits for a CRC byte (to prevent problems that could arise if when only even number of bytes are sent after an odd number of incorrect bytes are received).