Dcc++ Arduino Mega Problem Help!!! What am I missing?

David Downham Jan 4, 2021

  1. David Downham

    David Downham New Member

    2
    0
    1
    First of All Greeting from the UK
    Could some one please explain what is going on with the following:
    I have built and run several Dcc++ systems and JMRI using the Arduino Uno with no issues and all seems to work fine. I used an Arduino Clone and a Deek-Robot Motor shield 15v 2A power supply, again everything works. I appear to have sorted out my 308 error problems with this setup and seem to get good and consistant programming so I was keen to see if I could add wi-fi etc.
    I decided to experiment and build one with an Arduino Mega using either the Dcc++ ex software or the original Dcc++. So following the original instructions I used the same Deek-Robot Motor shield and Mega 2560 (Clone) and using one jumper from Pin4 to Pin 13, i loaded up the original basestation Dcc++ software. Before attempting to program anything I decided to test the voltage on the Main Track and Program Track Outputs: Main Track 15v (ac) Program Track 30v (ac) or 14v(dc). Using a multimeter on the ac setting gets 15v on the Main Track.On the Program Track either 0 or 30v depending which probe goes to which terminal or on the dc setting 14-15v dc. They should both be 15v ac. I notice that only 3 of 4 leds light on the Motor shield, both are lit on ther Main, Only one is lit on the Prog side.
    The result is the same on 3 different Mega from 2 separate sources, purchased at least 12 months apart and 3 different Motor shields and I have checked all of my measuring equipment and downloaded the source code and tried that, same result.

    If I then remove the jumper from Pin4 to Pin 13 and load the Dcc++ ex software and repeat the measurements i get: Main Track 15v (ac) Program Track 15v (ac) which is what I expect.It works but I am struggling to get consistant programming with the 308 error back again. I have tried the suggested fixes on the dcc++ex threads but none seem to work.

    Does anyone have any idea what I am doing wrong here? It should be simple since it works ok with the Uno but I am at a loss to know what I have done?Probably something dumb! Any comments would be gratefully received.
     
  2. Ash

    Ash TrainBoard Member

    106
    66
    8
    With DCC++EX, one issue I had was understanding the wiring for the Mega -- and removing the jumper on Pins 2 and 13. You might review the steps previously required for DCC++ motor shields vs. the steps from the dcc-ex.com site. (with regard to your reference: Pin4 to Pin 13.)

    I initially used the installer, but have since downloaded the zip file to install updates (Arduino IDE method). Before overwriting files, I review existing files in file manager, sorted by date -- helps me remember changes, etc.

    I do not have optional features enabled (or installed) -- wifi, LCD, etc. Train control via JMRI to Mega (DCC++ EX); accessories via JMRI, using CMRI/RS485 to Arduino pro mini with PCA9685 and MCP23017 modules.
     
  3. crusader27529

    crusader27529 TrainBoard Member

    247
    167
    11
    I'm pretty sure that DCC-EX uses NO JUMPERS on the standard motor driver board, and 1 jumper when you use DCC++.
     
  4. Roger Coleman

    Roger Coleman New Member

    3
    6
    1
     
  5. Ash

    Ash TrainBoard Member

    106
    66
    8
    I am doing some testing with another current sensor and motor board, and ran into the 308 error.

    I will check further on getting the problem resolved -- and it may not be a problem with the standard setup.

    There is a hard-coded static current of 65ma. This gets divided by the current factor to check pin readings on A1. With my new engine and decoder, 65 was too small. 90 worked, but does not work for the other locomotive I tested (-- that one works at 65).
     
  6. Ash

    Ash TrainBoard Member

    106
    66
    8
    That was changed in November. I was out of date.

    I have now updated to the 3.0.0 production release. One of the differences is the 65 is no longer hard-coded. I will inquire on how it is different, and perhaps it will lead to a solution for my issue.

    I still have some 308 errors. It seems the CVs are being read too quickly. I am using JMRI, and selected Compare full sheet -- and noticed in one section, that every second CV failed to read. When I read them one at a time, and pause between them, they all worked (most of them on the first try).
    TCS WowDiesel 121 Version 4 on GEN-MB1 motherboard with integrated KA4 Keep Alive.

    Perhaps the problem is partly related to the Keep Alive feature, but I also noticed it with a Bach-DSL decoder.

    Note that I am not using the standard motor shield and my current sensor is much less sensitive.
     
  7. Ash

    Ash TrainBoard Member

    106
    66
    8
    The hard-coded number now has a variable name: ackLimitmA = 60
    [DCCWaveform.h]

    There were still a few errors when set to 75 on the WowDiesel; 48 for Bach-DSL. But when CVs were read a second time, they all passed.

    When I update the variable, I also update the LCD text.
    LCD(1,F("Ready AST 48"))
    [CommandStation-EX]

    In prior post from August, @PeterV provided code to adjust AST using a potentiometer. This was in the early days of DCC++EX. I wonder if he has found the need to do it with the current version.

    With the extensively rewritten code, I thought that using a current sensor with higher sensitivity (e.g. standard motor shield or MAX471) would resolve this issue. I have ordered a MAX471...
     
  8. Ash

    Ash TrainBoard Member

    106
    66
    8
    And when the MAX471 arrived, I neglected to check the voltage output on its AT current pin. It was defective; Mega2560 was damaged by 12.8 volts.

    Instead of using a potentiometer, here is the information on how to adjust the ACK LIMIT
    https://dcc-ex.com/reference/software/diagnostic-d-ack-command.html

    And for the updated ACK LIMIT to display on the LCD, I added a line to the code
    -- about line 680 in DCCEXParser.cpp
    Code:
        case HASH_KEYWORD_ACK: // <D ACK ON/OFF> <D ACK [LIMIT|MIN|MAX] Value>
        if (params >= 3) {
            if (p[1] == HASH_KEYWORD_LIMIT) {
              DCCWaveform::progTrack.setAckLimit(p[2]);
              StringFormatter::send(stream, F("\nAck limit=%dmA\n"), p[2]);
            StringFormatter::lcd(1, F("\nAck limit=%dmA\n"), p[2]);  // line added 
            } else if (p[1] == HASH_KEYWORD_MIN) {
    To issue the command from JMRI, I updated to JMRI 4.21.3 test release.
    See topic 'Update JMRI:' https://mstevetodd.com/enhancing-your-rpi-jmri
    [​IMG]
     

Share This Page