DCC++ issues with D&H 10C - resolved

ThomasP May 21, 2017

  1. ThomasP

    ThomasP New Member

    8
    14
    4
    Hello alltogether,

    recently I ordered a bunch of D&H 10 C decoders to assemble them into a herd of locos. As I purchased a decoder tester recently, I hooked the first up to it and tried to read the adress - nothing, not a blip. Tried the next, the next after the next and so on, no reaction. I could operate them with regular main track signals, but programming was impossible. Even worse, formerly purchased DH10C performed completely normal. I guessed that Doehler&Haass has changed some firmware code. The initial feedback there was "well - a homebrew solution for the DCC controller... the error could be anything" :-(

    After a deepdive into the base station C++ code, long nights in front of the oscilloscope, and absorbing the NMRA standards in full, I have figured out what it was. I can imagine that others might run into the same snag, so I want to share this here with you.

    The culprit is the packet sequence that is used to trigger programming, e.g. in RegisterList::readCV in PacketRegister.cpp

    loadPacket(0,resetPacket,2,3); // NMRA recommends starting with 3 reset packets
    loadPacket(0,bRead,3,5); // NMRA recommends 5 verfy packets
    loadPacket(0,resetPacket,2,1); // forces code to wait until all repeats of bRead are completed (and decoder begins to respond)

    This is the original code from the BaseStation. The DH10C does not perform the acknowledgement because of the last resetPacket that is used to wait until all bRead Packets have been digested. I changed the resetPacket to another bRead Packet and all works fine.

    loadPacket(0,resetPacket,2,3); // NMRA recommends starting with 3 reset packets
    loadPacket(0,bRead,3,5); // NMRA recommends 5 verify packets
    loadPacket(0,bRead,3,1); // forces code to wait until all repeats of bRead are completed (and decoder begins to respond)

    Similar changes are necessary in the routines for WriteCVByte and WriteCVBit.

    So essentially this post is question and answer in one, but I hope it helps :).

    Happy model railroading,
    Thomas.
     
    MDLSoft, deHarry, pepeONrails and 5 others like this.
  2. AlbertK

    AlbertK New Member

    2
    2
    2
    Hello Thomas,

    thank you very much for your Work. Your changes also helped me with a D&H DH12A. In RegisterList::readCV i had two Places to change.

    Regards,
    Albert
     
    Scott Eric Catalano likes this.
  3. RCMan

    RCMan TrainBoard Member

    190
    98
    6
    I Have tried this fix on the basic DCC++ code for just reading all decoders. I have had some problems with a few Digitrac decoders.

    However is complies with an error.

    I get an error on this change.

    It reports: bRead' was not declared in this scope

    void RegisterList::writeCVBit(char *s) volatile{
    byte bWrite[4];
    int bNum,bValue;
    int c,d,base;
    int cv, callBack, callBackSub;

    if(sscanf(s,"%d %d %d %d %d",&cv,&bNum,&bValue,&callBack,&callBackSub)!=5) // cv = 1-1024
    return;
    cv--; // actual CV addresses are cv-1 (0-1023)
    bValue=bValue%2;
    bNum=bNum%8;

    bWrite[0]=0x78+(highByte(cv)&0x03); // any CV>1023 will become modulus(1024) due to bit-mask of 0x03
    bWrite[1]=lowByte(cv);
    bWrite[2]=0xF0+bValue*8+bNum;

    loadPacket(0,resetPacket,2,1);
    loadPacket(0,bWrite,3,4);
    loadPacket(0,resetPacket,2,1);
    loadPacket(0,idlePacket,2,10);

    c=0;
    d=0;
    base=0;

    for(int j=0;j<ACK_BASE_COUNT;j++)
    base+=analogRead(CURRENT_MONITOR_PIN_PROG);
    base/=ACK_BASE_COUNT;

    bitClear(bWrite[2],4); // change instruction code from Write Bit to Verify Bit

    loadPacket(0,resetPacket,2,3); // NMRA recommends starting with 3 reset packets
    loadPacket(0,bWrite,3,5); // NMRA recommends 5 verfy packets
    loadPacket(0,bRead,3,1); // forces code to wait until all repeats of bRead are completed (and decoder begins to respond)

    for(int j=0;j<ACK_SAMPLE_COUNT;j++){
    c=(analogRead(CURRENT_MONITOR_PIN_PROG)-base)*ACK_SAMPLE_SMOOTHING+c*(1.0-ACK_SAMPLE_SMOOTHING);
    if(c>ACK_SAMPLE_THRESHOLD)
    d=1;
    }

    if(d==0) // verify unsuccessful
    bValue=-1;

    INTERFACE.print("<r");
    INTERFACE.print(callBack);
    INTERFACE.print("|");
    INTERFACE.print(callBackSub);
    INTERFACE.print("|");
    INTERFACE.print(cv+1);
    INTERFACE.print(" ");
    INTERFACE.print(bNum);
    INTERFACE.print(" ");
    INTERFACE.print(bValue);
    INTERFACE.print(">");

    } // RegisterList::writeCVBit()
     
    Scott Eric Catalano likes this.
  4. AlbertK

    AlbertK New Member

    2
    2
    2
    Hello Dennis,

    in the Routines of RegisterList::writeCVBit and RegisterList::writeCVByte you should use bWrite like in the Line above. So it should look like:

    loadPacket(0,bWrite,3,1); // forces code to wait until all repeats of bRead are completed (and decoder begins to respond)

    To read and write "TAMS" and "Minitrix" Decoders also works like bevore the Changees.

    Regards,
    Albert
     
    Scott Eric Catalano likes this.
  5. RCMan

    RCMan TrainBoard Member

    190
    98
    6
    OK, Got it. Have not really done any code for several years. Most was in Pascal.
     
    Scott Eric Catalano likes this.
  6. Felix Schaepper

    Felix Schaepper New Member

    5
    0
    1
    Hi Dennis
    I have the same problem with D&H 05 C decoders (2 year old 10-C work just fine). With Base Station-1.2.1 the loks work fine on the main trak, but on the program trak, there is no response, no reading and no writing.
    I have made the above adjustments, now i can read the CV's but i still cannot write.

    My setup: rocrail, dcc++, 15 volt
    Any ideas?

    Regards
    Felix
     
  7. RCMan

    RCMan TrainBoard Member

    190
    98
    6
    Are you sure you have made all the required changes?
     
  8. Felix Schaepper

    Felix Schaepper New Member

    5
    0
    1
    i am not quite sure, i made 4 changes alltogether. Two in the "readCV" section from resetPacket,2,1 to bRead,3,1 and one each in the "WriteCVByte" and "WriteCVBit" sections from resetPacket,2,1 to bWrite,3,1.
    Is there more to change?
     
  9. Felix Schaepper

    Felix Schaepper New Member

    5
    0
    1
    Hi
    I got additional help from D&H. One of their customers had the sam issue with the DH05C. He resolved it with the help of Thomas an was kind enough to send me the edited files PacketRegister.cpp and PacketRegister.h . Now all is fine.

    Regards
    Felix
     
  10. NeOdx2

    NeOdx2 New Member

    7
    0
    1
    Hello Felix, can you please provide these files? I'am stuck at the same problem, with D&H05C :-( Or did you just replace the bRead and resetPacket as mentioned by thomas in opening post.
     
    Last edited: Feb 23, 2019
  11. RCMan

    RCMan TrainBoard Member

    190
    98
    6
    These changes need to be added as many times I see on other websites having the same problem.
     
  12. Felix Schaepper

    Felix Schaepper New Member

    5
    0
    1
    Hi evryone

    As requested, I upload the edited files that worked for me.

    Regards Felix
     

    Attached Files:

  13. NeOdx2

    NeOdx2 New Member

    7
    0
    1
    Thank you for fast response. Tested and works like a charme!
     
  14. Marty_G

    Marty_G New Member

    9
    8
    3
    I have about a dozen DCC locos with decoders from ESU, Soundtraxx Sound Value, Bachmann and MRC and for the most part reading and writing CVs with DCC++ has worked well. A while back I bought a Lionel HO Polar Express as a cool thing for the grand kids and for whatever reason I could not read CVs with DCC++ but a friends NCE Power Cab would read and write so I set it up that way. The stock Lionel decoder actually performed rather poorly, in my view, and eventually malfunctioned losing Bluetooth and sound. I tried everything to reset it with no improvement.

    Finally I bought a replacement Soundtraxx Tsunami 2 steam decoder and popped it in. Wow, what a huge improvement over any of my other decoders. So, after install I ran it around the track using the default address 3 pushing all of the function keys and having a good time. After a bit I put it on the programming track and DCC++ would not read any CVs. Checked all connections etc. but no reads. Finally I swapped it for another loco with an ESU decoder and it read CVs fine.

    Put the Tsunami loco back on the programming track and nothing. I then recalled this thread. I loaded up the new files uploaded to the Uno powered up the programming track and holy smokes DCC++ is reading and writing the Tsunami CVs like a champ. Works perfectly!

    Many thanks for figuring this out and making the files available.

    Best regards,
     
  15. RCMan

    RCMan TrainBoard Member

    190
    98
    6
    Glad you got it running and happy with the DCC++ unit.
     
  16. roby02091987

    roby02091987 New Member

    1
    0
    1
    I had the same problem with my DH10C decoder, and this post helped me a lot!
    Thank you very, very much for sharing it, Thomas, and thanks also to Felix for the files!
     
  17. ThomasP

    ThomasP New Member

    8
    14
    4
    Hi altogether,
    I am glad that my post has found so much resonance and was helpful to quite a few people. Thanks so much for your feedback, that proves to me it was worth the time. And thanks to everyone that has developed this further.

    Thomas

    P.S. Roby: a nice welcome to this forum, and I find it very nice that your very first message here goes out with this positive message about this topic, that made my day!
     

Share This Page