Arduino 2560 and Pololu Motor Shield 308 error

Andy S Feb 9, 2020

  1. Andy S

    Andy S TrainBoard Member

    34
    30
    2
    My new DCC++ hardware (read- Pololu set up) can't seem to read CV codes... I get that good ol' 308 error.

    So here's the back ground: I have 2 Arduino Uno's and 2 Arduino Mega 2560's... ALL work fine with the Arduino 298 motor shield, tho I DID have to adjust the PacketRegister.H, ACK sample threshold from 30 to 5 to avoid the 308 error. I'm using the same loco with a Tsunami2 decoder, and the same instance of JMRI. All is well...except, I'm an S Scale guy and thrive on frustration, so I decided to go for the higher amperage Pololu shield.

    Using a known good Arduino Mega, with the Pololu shield, the same loco, the same instance of JMRI, I can operate the main, blind program on the main and basically operate everything except the programming channel/track, I DO have power to the programming track and lights dim to indicate receipt of signals, but I get the 308 error.

    I would have assumed (yeah, I know what that means), that with known software loaded on a known operable Mega and common JMRI and decoder/loco, the motor shield would pass the ACK coding...obviously, that's not the case.

    I was hoping there might be an all great and powerful Wizard of DCC++ that might be able to provide some knowledge and guidance to help get this Pololu to read a page of CVs on the programming track.

    Any help or additional knowledge would be greatly appreciated.

    Cheers

    Andy
     
  2. wvgca

    wvgca TrainBoard Member

    365
    172
    17
    huh ,,, the 308 error means that the Arduino could not read the drop that supposed to be associated with programming .. either the pins are different on the new one, or the signal isn't getting through ..
    time to read the manual ..
     
  3. Andy S

    Andy S TrainBoard Member

    34
    30
    2
    Manual? There’s a manual somewhere out there? I think the pinout is OK... with the wrong pins, the ac signal would not be available to the track, it would strictly be a dc signal. ac is there, both lights on the “b” side (programming side) of the shield are there and the loco responds to a programming signal (lights flash)... but the ACK pulse is not meeting the criteria to be read (whatever that criteria is)... this is the identical scenario that I originally had with the 298 shields... that was resolved by changing the sample threshold on PacketRegister.h. Unfortunately, that doesn’t seem to resolve the issue with the Pololu shield.
     
  4. RCMan

    RCMan TrainBoard Member

    256
    112
    10
  5. Andy S

    Andy S TrainBoard Member

    34
    30
    2
    Thanks Dennis.... I’ve been working off that doc. Pin outs are Not the issue. Wvgca sugested a “manual”.... I have yet to find that. I’m a firm believer that “rtfm” issues are the major causes of most problems.... but you need the have the manual first. Gregg’s software documentation is great for understanding the code, but the actual electronic process is what I’m trying to decipher .... what signal isn’t his code seeing?
     
  6. Andy S

    Andy S TrainBoard Member

    34
    30
    2
    And the plot thickens.... (Insert spooky music here)

    SO... In absence of any manuals I started with the NMRA Spec S 9.2.3, section D: Decoder Acknowledgment Mechanism, which calls for a 60mA increased load for 6ms as an ACK pulse..... so far so good!!! Now how does the Pololu MC33926 detect that pulse? It appears as though it doesn't!

    Read: https://forum.pololu.com/t/current-...or-driver-shield-for-arduino-low-values/13033

    Which leads me to the NEW QUESTION for this thread: Does anyone use the Pololu MC33926 motor shield for programming in the service channel (Programming Track)??? If so, how? My guess is that the primary use of the shield is for the 3 amp capability on the operating side and any programming is done blind on the main.

    That brings up another question that I saw in another thread... why not reprogram the "B" side (an apparently spare 3 amp motor controller) for a second operational channel, perhaps for a second block? Ahhh... but that's food for thought for a future discussion.

    For now, It appears I'll have to forgo any attempt to program on the Pololu service channel and use it for the primary DCC++ operation track, which was the primary reason for making the change.

    Thanks to both RCMan and wvgca for your replies!!! I truly hope this thread will help others in future 308 error puzzles!

    Cheers

    Andy
     
  7. wvgca

    wvgca TrainBoard Member

    365
    172
    17
    well, manual refers to a pdf or help file on the shield in question ... should say on what pins the current sense is taken, and what levels, etc ..
     
  8. RCMan

    RCMan TrainBoard Member

    256
    112
    10
    Yes, I have the 2560 and the MC33926 motor shield working just fine. Built mine a couple of years ago.

    Have not used not lately and thinking of selling it. Works real well in service mode.

    Let me hook is up and check the setting in JMRI.

    Dennis
     
  9. RCMan

    RCMan TrainBoard Member

    256
    112
    10
    Connected the DCCpp to my computer and configured it for DCCpp.

    Brought up JMRI and placed a Loco on the Programming track.
    Brought up the Roster and started a new Loco and let JMRI fine it, and it did.
    Next did "Read Full Sheets" on several pages and it read them all without one 308 error.
    I even tried both Direct Byte and Direct Bit and both worked reading the decoder. (ESU Lokpilot micro V4.)

    Question:
    1. Did you cut the traces on the Pololu underside per the drawing and verified they are open?
    2. Did you recompile the DCCpp sketch for using the Pololu board and not the Arduino board, they are different pinouts.
     
    Last edited: Feb 9, 2020
  10. Andy S

    Andy S TrainBoard Member

    34
    30
    2

    Cut all three traces as described, and checked with DVM.
    Pin outs are from PDF and set for appropriate Arduino Mega
    Sketch was recompiled with Pololu “1” in config
    Sample threshold was tried at several levels from the original 30, tried at 2,5,8 and 10. No joy.

    Can you share what the readings are in your PacketRegister.h ?
    K
     
  11. RCMan

    RCMan TrainBoard Member

    256
    112
    10
    I will post my PacketRegister.h sketch.
    This is looking like maybe a bad shield.


    Dennis
     
  12. RCMan

    RCMan TrainBoard Member

    256
    112
    10
    Here is my PacketRegister.h file.

    It is a zip file.

    Dennis
     

    Attached Files:

    Richard AUS likes this.
  13. Andy S

    Andy S TrainBoard Member

    34
    30
    2
    Dennis,

    Thank you so much for your time and effort. Your PacketReister.h file has the Sample Threshold set at 15, all others remained the same, and the file is identical. Same results on this end... the Pololu shield simply can't detect the acknowledgement pulse, resulting in a 308 error.

    I checked the voltage on the Pololu M2FB pin (Arduino pin A1), and I can see a very weak .5mV change with each CV read, but my guess is that the signal is simply insufficient to trigger anything but a -1 in the DCC++ programming. This coincides with the

    While it COULD be a faulty shield, this is the identical problem that I had with the 298 shields until I reset the SampleThreshold to 5. Combined with the fact that the first thing done to the board was to cut 3 traces, it's doubtful a refund or exchange is an option.

    My current (no pun intended) thought is to use the board as intended, as an operational piece. I can certainly program off of another Arduino/298 combo on a program track, and blind program with the Pololu on the main. My intent is to use a "headless" Raspberry Pi for the JMRI software, and VNC into it as needed from my Mac. That's all up and working fine. Due to a faulty turnout (now repaired) I also discovered that the current detect and shut off works just fine on the Pololu (y) so for normal main line operations... it should be fine.

    I'm sure I'll keep playing with this for a while... I'll report back with any new findings.

    Dennis, thanks again for your time and efforts... they're much appreciated!

    Andy
     
  14. RCMan

    RCMan TrainBoard Member

    256
    112
    10
    Andy, anytime.
    If you want to ship me the board in the future maybe I can find out why is it not working correctly.

    BTW: the setting used was to be able to read Digitrax decoders better.

    Dennis
     
  15. Andy S

    Andy S TrainBoard Member

    34
    30
    2
    Dennis...

    Thanks for the offer. I think I'll pull out the scope and play with it a bit... and see if I can "get smarter."
    I understand changing the threshold... the Tsunami actually works well with the 298 shield at an 8... at 9 it became marginal.... I'm using a 5 on the 298 shields and it seems solid.

    Thanks Again

    Andy
     
  16. David Jennex

    David Jennex TrainBoard Member

    15
    16
    5
    That brings up another question that I saw in another thread... why not reprogram the "B" side (an apparently spare 3 amp motor controller) for a second operational channel, perhaps for a second block? Ahhh... but that's food for thought for a future discussion.

    Andy,

    This is very simple. Just jumper pin 12 to both pin 8 as well as pin 7. I have a switch which sets eight bach to 2 when I need prog.

    David
     
  17. riots1337

    riots1337 New Member

    1
    1
    1
    I don't have answer for your issue, but this bit of gold solved mine! Thanks!
    Just getting started and had 2 BLI locos that worked fine with dcc++ out of the box. Bought a new Athearn Genesis and couldn't read CVs until I made this change.
    I have a Mega clone with a 298 shield.
     
    Richard AUS likes this.
  18. Richard AUS

    Richard AUS New Member

    3
    2
    2
    Thanks to the discussion on this board regarding the 308 problem I was able to solve my problem - a big THANK YOU. I have attached a file of what I did so that others may also see how easy it was to solve this issue.
     
    FlightRisk likes this.
  19. FlightRisk

    FlightRisk TrainBoard Member

    508
    198
    11
    Just to add to this if people stumble here in the future, you can get live support on our Discord channel: https://discord.gg/y2sB4Fp We also recommend switching from DCC++ "Classic" to DCC++ EX since it has more built into it related to current and current sense. Then next release is a complete rewrite of the code and handle ACK detection in the proper way which also gives a significant speed increase when reading CVs. We have been doing a lot of testing on different track voltages and actual current sense for different motor boards as well as discreet current sense boards. Our manual and the website will try to explain it all in simple terms with recommendations on motor boards and any modifications. Anyone wanting to help with the project can submit documentation or help us write the content for the web page. Thank you!
     
  20. Sumner

    Sumner TrainBoard Member

    1,306
    1,603
    31
    Will EX run on a Uno?

    Sumner
     

Share This Page