This shows you the differences between two versions of the page.
| Next revision | Previous revision | ||
|
projects:a4sim:troubleshooting [2020/01/15 05:50] dwheele created |
projects:a4sim:troubleshooting [2020/05/07 05:13] (current) dwheele [Solution] |
||
|---|---|---|---|
| Line 9: | Line 9: | ||
| - The logic to respond to inNonZero was not properly working. As of this writing, this part seems to be configured correctly. | - The logic to respond to inNonZero was not properly working. As of this writing, this part seems to be configured correctly. | ||
| + | ===== I2C Communications Issues ===== | ||
| + | |||
| + | Had problems getting communications to work with Arduino Mega 2560, with 2.8 TFT display. The display was showing flight control positions in an " | ||
| + | |||
| + | Tried various things to get this working. | ||
| + | |||
| + | **Pull-Up Resistors** | ||
| + | |||
| + | I added pull-up resistors to the I2C channel. Sadly, I used the wrong values (too much resistance), | ||
| + | |||
| + | **Change I2C Baud Rate** | ||
| + | |||
| + | Experimenting with the I2C Baud Rate is what made the solution become apparent. 100Kbps is the default speed. When I changed the rate to 10Kbps, it all started working. 50Kbps continued to fail. Changed to 200Kbps, failed the same, until changing the pull up resistors as described elsewhere. | ||
| + | |||
| + | **Multiplexer** | ||
| + | |||
| + | Implemented a I2C Multiplexer so that individual I2C devices can be separated to their own channel. This also allows additional cable runs. This was a hardware change, as well as a software change. The Raspberry Pi must change the I2C channel (if needed) before sending/ | ||
| + | |||
| + | ==== Solution ==== | ||
| + | |||
| + | Placed stronger pull-up resistors between SDA and SCL and +5V. Tried different values. 950 ohm worked best. Was able to change the I2C Baud rate to 200K. | ||
| + | |||
| + | These resistors are soldered to the Arduino Mega 2560 Channel 46. | ||
| + | |||
| + | **Additional Solution**: In Arduino code, the I2C handler is looking for a fixed number of bytes on the inbound message. If it doesn' | ||
| + | |||
| + | With code like this: | ||
| + | |||
| + | <code c> | ||
| + | // Read off all of the bytes | ||
| + | for (i = 0; i < numBytes; i++) { | ||
| + | byteBuffer[0] = Wire.read(); | ||
| + | } | ||
| + | </ | ||
| + | |||
| + | ===== Arduino Mega 2560 Stopped working ===== | ||
| + | |||
| + | The Arduino with the LCD display on it stopped working. I had started changing the voltage of pin 2 of the JST connectors to be 12 volts instead of 5 (because connected devices need 7 - 12 volts because their internal regulators always drop at least 1 volt). I had plugged a 12V adapter into the barrel power socket of the Arduino Mega 2560 and things started behaving badly. Specifically, | ||
| + | |||
| + | ==== Solution ==== | ||
| + | |||
| + | Noticed that the 4-pin JST connector had shorted to a neighbor pin. This pin was the 12V pin, and unfortunately, | ||
| + | |||
| + | After fixing the breadboard traces, I replaced the Arduino Mega 2560 (Channel 46) and it is working again, now powered by the 4 pin JST, with 12V input. | ||
| + | |||
| + | ===== Can't upload to Arduino Nano from emakefun.com ===== | ||
| + | |||
| + | Tried to upload in the usual way to Arduino Nano from emakefun.com (very cheap, from Amazon). I kept getting obscure communication errors. | ||
| + | |||
| + | ==== Solution ==== | ||
| + | |||
| + | Resetted Nano, then need to select "old bootloader" | ||
| + | |||
| + | [3/13/2020] | ||
| + | |||
| + | ===== Malloc error for two-OLED Display implementation ===== | ||
| + | |||
| + | Worked on getting two OLED displays to work at the same time connected to an SoftI2CMaster I2C implementation. This was caused because the byte buffer each took about 1K of memory, but there is only 2K of Dynamic RAM. Solved the problem by reusing the buffer between the two displays. | ||
| + | |||
| + | [5/5/2020] | ||