DCC-EX / CommandStation-EX

EX-CommandStation firmware from DCC-EX. Includes support for WiFi and a standalone WiThrottle server. A complete re-write of the original DCC++.
https://dcc-ex.github.io/
GNU General Public License v3.0
153 stars 103 forks source link

Franzi hh fast clock #348

Closed FranziHH closed 4 weeks ago

FranziHH commented 10 months ago

Hi,

FastClock implementation is faulty. Here is my suggestion. The instructions for integrating FastClock into DCC-EX are also incorrect.

For the serial connection, it is sufficient in the config.h Comment out one of the serial ports e.g.

define SERIAL1_COMMANDS

The integration of I2C did not work at all this is my suggestion that works for me.

It just needs to be in the config.h

define FAST_CLOCK_I2C 0x55

can be defined and, if necessary, the address can be adjusted

Many greetings, Franziska

Here are the two debug outputs before and after my change:

The order of initialization did not work for I2C

original edition

<* License GPLv3 fsf.org (c) dcc-ex.com *>
<* Checking for Clock *>
<* Clock check result - 3 *>
<* LCD6:CLOCK NOT FOUND *>
<* I2C Device found at 0x3C, OLED Display? *>
<* I2C Device found at 0x55, EEPROM? *>
<* MCP23017 I2C:0x20 Device not detected *>
<* MCP23017 I2C:0x21 Device not detected *>
<* Found PORTB pin 13 *>
<* Pin 55 Max 1497mA (501) *>
<* Found PORTB pin 12 *>
<* Pin 54 Max 1497mA (501) *>

after my change

<* License GPLv3 fsf.org (c) dcc-ex.com *>
<* I2C Device found at 0x3C, OLED Display? *>
<* I2C Device found at 0x55, Fast Clock? *>
<* Checking for Clock *>
<* Clock check result - 0 *>
<* I2C Fast Clock found at 0x55 *>
<* EXFastClock::create *>
<* MCP23017 I2C:0x20 Device not detected *>
<* MCP23017 I2C:0x21 Device not detected *>
<* Found PORTB pin 13 *>
<* Pin 55 Max 1497mA (501) *>
<* Found PORTB pin 12 *>
<* Pin 54 Max 1497mA (501) *>
<= A MAIN>
<= B PROG>
<* 128x64 OLED display configured on I2C:0x3c *>
<* LCD0:DCC-EX v5.0.2 *>
<* LCD1:Lic GPLv3 *>
<* ++ Wifi Setup Try 1 ++ *>
(...)
<* Wifi Check: [\r\nOK\r\n\0] *>
ATE0\r\n\r\nOK\r\n<* Found in 4ms *>
<* WiFi CONNECTED *>
<iDCC-EX V-5.0.2 / MEGA / STANDARD_MOTOR_SHIELD G-3bddf4d>
<* LCD3:Ready *>
<p0>
<* LCD2:Power Off *>
<* LCD3:Free RAM= 2262b *>
<* LCD6:Clk Time:562 Sp 4 *>
<jC 562 4>
<* LCD3:Free RAM= 2248b *>
<* LCD6:Clk Time:563 Sp 4 *>
<jC 563 4>
<* LCD6:Clk Time:564 Sp4 *>
<jC 564 4>
<* LCD3:Free RAM= 2239b *>