DCC++ Decoder CVs Reading Problem. Error 308 JMRI

Quentin Feb 24, 2018

  1. TwinDad

    TwinDad TrainBoard Member

    1,844
    550
    34
    Watch the output of the JMRI Serial Monitor while attempting a write. If JMRI reports the value returned by the write attempt is -1 then it's definitely not a problem with JMRI. The -1 is the DCC++ Base Station reporting that it did not receive an acknowledge pulse from the decoder.

    The 308 error is just higher level code in JMRI reporting that it received the -1 message from the base station.
     
    Last edited: Mar 16, 2018
    Scott Eric Catalano likes this.
  2. Pieter

    Pieter TrainBoard Member

    151
    46
    10
    P.S. the decoder manufacture code is 127 which is for Atlas and not NEC which would be 11!! Yet the decoder came packaged from NCE.

    The manufactures, although some make their own decoders, are using others instead of their own. ESU decoders are popping out all over in different makes. E.g. one of the new Big Boy released end of last year has ESU sound decoder in.

    Would still like to fix the DCC++ / JMRI situation. Maybe if someone else reads this post they could point me in the right direction.

    If you can move your engine & program it then I would say the problem isn't JMRI. Could be your shield is the problem. Check your wiring of the pins. Beware there is an older pdf floating around with outdated wiring for the Uno & Mega. Have you selected the correct shield when you programed your Uno?

    1. // DEFINE MOTOR_SHIELD_TYPE ACCORDING TO THE FOLLOWING TABLE:
    2. //
    3. // 0 = ARDUINO MOTOR SHIELD (MAX 18V/2A PER CHANNEL)
    4. // 1 = POLOLU MC33926 MOTOR SHIELD (MAX 28V/3A PER CHANNEL)

    5. #define MOTOR_SHIELD_TYPE 1
    See also the posts around ESP32 as the last few week they were also touching on the different power shield and the possible pin problems with some of them.
     

    Attached Files:

    Scott Eric Catalano likes this.
  3. George S

    George S New Member

    5
    5
    1
    Pieter,

    I agree with you. It's not in JMRI but in the arduino/Vellemen shield. I received another reply from Atani, indicating that the Vellemen KA03 board does not have current sense onboard. I confirmed this in the board schematic which has both sense pins grounded. STMicro recommends 0.5 ohm resistors on these pins to ground. I would have to lift the PowerSO20 pins 2 znd 19 off their pads and solder resistors between them and ground.
    I keep seeing people mentioning current sense being necessary to read and write to the decoder with this setup.
     
    Scott Eric Catalano likes this.
  4. Atani

    Atani TrainBoard Member

    1,340
    1,050
    29
    Ok if the schematic has the sense pins to GND that is why you can not read CVs. A voltage divider circuit between the pin GND and the analog pin should work. You may need to adjust the numbers in the current monitor code as they are currently tailored to the Arduino shield. In the esp32 code it is dynamically calculated for each motor shield and current limit.

    Sent from my ONEPLUS A5010 using Tapatalk
     
    Scott Eric Catalano likes this.
  5. George S

    George S New Member

    5
    5
    1
    Atani,

    Thanks for the infomation. I'll check it out. Trainboard has really been great at finding ideas and solutions. Hey, if it was easy, it wouldn't be any fun!!
     
    Atani likes this.
  6. Pieter

    Pieter TrainBoard Member

    151
    46
    10
    There is another way but I haven't seen it applied in DCC++, but in other DIY DCC which include off shoots of Cmdrarduino. There are a few flavors of ACK boards floating around on the internet. And then a little bit of programming for the pin used (P Gahtow did it in his DCC project). Below an e.g. of one ACK board. This one use a pot to fine tune the readings.


    [​IMG]
     
    Scott Eric Catalano likes this.
  7. TwinDad

    TwinDad TrainBoard Member

    1,844
    550
    34
    I just submitted a Pull Request to the DCC++ code base. This creates a new setting in Config.h (MOTOR_SHIELD_SUPPORTS_FEEDBACK).

    If this is set to "0", then programming track writes will send back a "-2" response instead of a "-1" when the feedback from the motor shield fails. This will block JMRI from
     
    Scott Eric Catalano likes this.
  8. Atani

    Atani TrainBoard Member

    1,340
    1,050
    29
    Unfortunately, it appears that the DCC++ GitHub project is pretty much dead :( Not sure what will happen to your PR unfortunately.

    Does JMRI recognize -2 now as well? I can put in similar code for the ESP32 branch as well as my fork of the Arduino base station if it does.
     
    Scott Eric Catalano likes this.
  9. TwinDad

    TwinDad TrainBoard Member

    1,844
    550
    34
    Oh. Well... Where is the DCC++ code being maintained? Or is it?

    The change is almost trivial. I could post the patch here.

    JMRI doesn't do anything special with the -2 yet. It looks specifically for the -1 and if it sees the -1 will post the 308 error. Any other value (including -2) will result in a "OK" response. I'm taking advantage of that to avoid the synchronization problem between codebases of specifically handling a new special value.

    JMRI will still wait for the full timeout before moving on*, which makes for some annoyingly slow page write behavior. I'm looking into the safest way to make that go faster, since you *do* want to delay JMRI at least a little bit to give the decoder time to complete the write. I'm looking at whether existing mechanisms within JMRI will do that, or whether it's best to have the Base Station delay the response by some (shorter-than-now) delay.

    Some future version of JMRI *might* do something special with -2 but there actually isn't much of a need to. I'm also looking at adding a configuration within JMRI (e.g. a new base station type name, or a checkbox on the connection preferences pane) so that JMRI will just not look for a response. This would make JMRI work with older versions of the DCC++ code that don't send the -2. There's sort of a precedent with the Digitrax DB150 command station, which does not have read capability either.

    You can see the edits I made here:

    https://github.com/msunderwd/BaseStation-Uno/commit/54200122bf8a294adf1d927191a0efe67ff62335

    This is the PR: https://github.com/DccPlusPlus/BaseStation/pull/33

    (Let me know if the link is private or otherwise doesn't work)

    * Actually it's waiting for the response from the Base Station, which is still waiting the full DCC++ timeout for the current pulse which will never come. JMRI always gets the response, just not until the Base Station gives up and sends the "I didn't hear anything" message.
     
    Scott Eric Catalano likes this.
  10. Atani

    Atani TrainBoard Member

    1,340
    1,050
    29
    Generally not, I can add the same change you did on my repo and I am sure @Trusty can do similarly in his library version of the base station code.

    Perfect :) I am thinking on the DCC++ESP32 version I can short circuit the reads so we can avoid having a config value. The ESP32 version of the base station is a bit more streamlined than the Arduino as far as current sense so it should be possible to avoid a long delay for failure cases (like 25-30 consecutive failed reads).
     
    Scott Eric Catalano likes this.
  11. TwinDad

    TwinDad TrainBoard Member

    1,844
    550
    34
    I'd prefer having the base station handle the delay or lack thereof. It helps keep JMRI "clean" of proliferation of a bunch of different variants. The LocoNet code is actually pretty hard to follow partially because of all the work put in to be flexible to the various different Digitrax (and other) command stations and their idiosyncrasies.
     
    Scott Eric Catalano and Atani like this.
  12. Danny Moss

    Danny Moss New Member

    5
    4
    4
     
  13. Quentin

    Quentin New Member

    3
    3
    1
    Hello guys, sorry for the (extremely) late answer...
    i finally managed to get back to it.
    My original problem was the lack of read-back when i was asking for CVs. Maybe i should have documented myself a little better : the locos were indeed moving so they could answer, but how could you retrieve anything without having the current-sense plugged in :D . I first thought (for unknown reasons) that the current sensor was just for security...
    Since then i managed to get everything working, reading/writing CVs. thanks very much for all the answers :)
     
  14. Les B49

    Les B49 TrainBoard Member

    37
    3
    6
    Message below now irrelevant - my problem seems to be solved. Possibly just poor track connections due my poor soldering techniques. Re-wiring everything gives me good Read/Writing of CVs. Sorry for any inconvenience.
    Les
    -----------------------------
    (Original message)
    Hi, guys.

    I have a similar problem which I placed in a different post a few days ago (entitled "CV issues with my very first decoder setup")
    - I didn't read this post until today, thinking this was JMRI-specific & I don't know anything about JMRI! I'm still a novice with everything DCC.

    Anyway, Jimbo (who is helping me out in my own post) thinks I may have a current-sensing problem & suggests tweaking the current sense calibration - similar to a comment on here, I think. Can you suggest which variables to change and in which direction/to what?

    My set-up is Arduino Mega + Arduino Motor Shield (Rev 3). G-scale (but lightweight) Lilliput tram. Both Prog & Main tracks showing just over 16V on my DMM. Throttle works on Main. Read/Writing CVs seems to fail on both tracks - without the slightest judder from the engine.

    I don't know what is meant by "boosters" in this post, but is the suggestion here that the standard Arduino Motor Shield maybe isn't powerful enough for G-scale? Does the fact that I can throttle my tram ok mean in my case it is sufficient?

    Many thanks,
    Les
     
    Last edited: Mar 31, 2018
  15. Richard AUS

    Richard AUS New Member

    3
    2
    2
    Erik84750 likes this.
  16. FlightRisk

    FlightRisk TrainBoard Member

    522
    214
    12
    There are other issues with the Pololu board people should be aware of related to current sense. For more information, see our website https:\\dcc-ex.github.io or get live support on our Discord server https://discord.gg/y2sB4Fp. We do monitor here, but with all the different groups and forums TrainBoard, JMRI groups.io newsgroup, Facebook Groups, etc. we may miss your support request and we would hate to do that!
     
    Richard AUS likes this.

Share This Page