Trains.com

Subscriber & Member Login

Login, or register today to interact in our online community, comment on articles, receive our newsletter, manage your account online and more!

Trying to understand 128 speed step command packets

1417 views
11 replies
1 rating 2 rating 3 rating 4 rating 5 rating
  • Member since
    October 2015
  • 188 posts
Trying to understand 128 speed step command packets
Posted by passenger1955 on Thursday, September 15, 2022 3:01 PM

Is there anyone on here who is familar with DCC packet structures? I'm trying to understand the packet structure of 128 step speed commands.

My initial impression was that they would build on top of the 28 speed step command packets by appending a byte on the end (that way older decoders could utilize the same command for 28-step needs).

But when I read through the DCC spec document S-9.2.1 line 223 it describes the initial packet structure of CCCGGGGG where GGGGG=11111 (which I know is not part of the 28 step packets).  https://www.nmra.org/sites/default/files/standards/sandrp/pdf/s-9.2.1_dcc_extended_packet_formats.pdf

This leads me to believe that 128-step speed commands are not just an extension of 28 speed step commands.

Is there anyone who could enlighten me on this?

  • Member since
    July 2009
  • From: lavale, md
  • 4,640 posts
Posted by gregc on Thursday, September 15, 2022 3:57 PM

a standard "baselline" packet contains 4 bytes: preamble, address, data and error-detection.

the upper 2 bits of the baseline packet data byte are 01.   a data byte where those upper 2 bits isn't 01 can be an extended packet (see s-9.2.1).

the 3rd byte in an extended packet with 128 speed steps is 001 11111 and the 4th byte defines the speed DDDD DDDD, followed by the error detection byte

26

greg - Philadelphia & Reading / Reading

  • Member since
    October 2005
  • 1,033 posts
Posted by betamax on Thursday, September 15, 2022 4:58 PM

Ref: NMRA Standard S-9.2.1 Extended Packet Formats

2.3.2.1: GGGGG = 11111: 128 Speed Step Control

001GGGGG 0 DDDDDDDD

The 001 is a command controlling advanced decoder functions (2.3.2)

The bits represented by G are instructions to the decoder that this packet contains a 128 speed step instruction, the following byte (D) uses bit 7 to determine direction and the speed is represented by bits 0-6. 

Now, 2.3.3 is about the 28 speed step mode, where only one byte is used, 

CCCDDDD

Where CCC=010 for reverse or 011 for forward, and the remaining bits indicate speed.

If you have an older 14 speed step decoder and send it a 28 step packet the headlight will toggle as bit 4 is now used to control the headlight, which toggles every time the throttle is changed. This will also happen if CV29 is set for 14 speed step mode (which is now obsolete.) (See S-9.2).

As you can see, the packet format for 14 and 28 steps uses only one data byte, and for 128 steps the first data byte tells the decoder which mode to use, and the second data byte has the speed/direction instruction.

That allows the decoder to determine whether 28 or 128 step mode is in use and act accordingly without user intervention. The default value for CV29 enables this mode.

Tags: DCC
  • Member since
    October 2015
  • 188 posts
Posted by passenger1955 on Thursday, September 15, 2022 9:10 PM

Thank you. So am I incorrect in my initial assumption that there is a single speed command which encompasses 14,28 and 128 step speeds in a single packet?  And that instead there is a packet structure for 14/28 speed steps, and a separate packet structure for 128 speed step instructions?

  • Member since
    July 2009
  • From: lavale, md
  • 4,640 posts
Posted by gregc on Friday, September 16, 2022 4:21 AM

yes, a baseline 3 byte packet carries a 28 step command and an extended 4 byte packet carries a 128 step command

greg - Philadelphia & Reading / Reading

  • Member since
    October 2005
  • 1,033 posts
Posted by betamax on Friday, September 16, 2022 5:54 AM

As mentioned, the baseline packet has three bytes: Address, Instruction/Data, and Error. The data includes 4 or 5 bits used for speed indication in 14 and 28 step modes.

The Extended packet can have 2 or more instruction bytes, with instructions to do multiple things, such as consisting, consist function assignments, and of course activate 128 speed steps using data in the following byte.

This allows for some backward compatibility.

If you are referencing the S-9.2.1 standard, make sure you are looking at the most recent revisions. The most recent is May 2022.

 

Tags: DCC
  • Member since
    October 2015
  • 188 posts
Posted by passenger1955 on Friday, September 16, 2022 9:22 AM

Thanks for your patience - I'm almost there. DCC Wiki says "128 speed step mode requires two bytes of data. One byte is the equivalent speed in 28 step modes, the other contains the additional speed step value."


This leads me to believe that the packet structure of the Instruction is 2 bytes:
28-step speed byte, 128-step speed byte

The extended packet structure says the Instruction is 2 bytes:
CCCGGGGG(00111111), 128-step speed byte

The extended packet structure does not appear to contain the 28-step byte


So is the final Instruction packet 3 bytes?

28-step speed byte, 00111111, 128-step speed byte

  • Member since
    October 2005
  • 1,033 posts
Posted by betamax on Friday, September 16, 2022 12:11 PM

The 28 speed step instruction is contained in one byte, the first three bits determine direction the next five bits the speed.

in 128 step mode, the first byte contains instructions and sub instructions, the second byte contains the direction in bit seven with bits 0 to 6 having the speed value.

 

  • Member since
    July 2009
  • From: lavale, md
  • 4,640 posts
Posted by gregc on Friday, September 16, 2022 12:19 PM

passenger1955
So is the final Instruction packet 3 bytes? 28-step speed byte, 00111111, 128-step speed byte

the baseline packet is (4 bytes)

preamble address data error-detection

the entended packet is (5 bytes)

preamble address data1 data2 error-detection

in the extended packet, data1 is CCCG GGGG and data2 is DDDD DDDD where DDDD DDDD is a direction plus 7 speed bits

greg - Philadelphia & Reading / Reading

  • Member since
    October 2015
  • 188 posts
Posted by passenger1955 on Friday, September 16, 2022 12:39 PM

So it sounds like we are saying DCC Wiki is incorrect in the statement below:

"128 speed step mode requires two bytes of data. One byte is the equivalent speed in 28 step modes, the other contains the additional speed step value."

Instead, there is one packet structure for 28 step commands, and a second structure for 128 step commands.

And the user sets his cab controller in either 28-step or 128-step mode, and the cab doles out one set of commands or the other.

Is this correct?

  • Member since
    July 2009
  • From: lavale, md
  • 4,640 posts
Posted by gregc on Friday, September 16, 2022 3:00 PM

passenger1955
"128 speed step mode requires two bytes of data. One byte is the equivalent speed in 28 step modes, the other contains the additional speed step value."

i don't see s description of that packet.   it doesn't conform to either the baseline or extended format.  sect 2.3.2 of s-9.2.1 says only a single advanced operation instruction may be contained in a packet.   

i don't see sect 2.3.2.1 of that spec describing the 128 speed step command as containing the baseline speed data value.

presumably the byte following a 01DCSSSS data value is the error detection byte

passenger1955
And the user sets his cab controller in either 28-step or 128-step mode, and the cab doles out one set of commands or the other.

my understanding is the cab (the controller) sends proprietary commands (e.g. button presses) to a command station and the command station periodically (e.g. speed) or when necessary (e.g. light, horn) formats DCC commands for each active decoder which it sends to one or more boosters.   presumably the user has configured the command station to send 28/128 speed steps

greg - Philadelphia & Reading / Reading

  • Member since
    October 2015
  • 188 posts
Posted by passenger1955 on Friday, September 16, 2022 4:39 PM

Thanks to you both. I had an initial premise that there was a single speed command that worked for all decoders (14,28,128) which had me confused. Appreciate the help.

Subscriber & Member Login

Login, or register today to interact in our online community, comment on articles, receive our newsletter, manage your account online and more!

Users Online

There are no community member online

Search the Community

ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT
Model Railroader Newsletter See all
Sign up for our FREE e-newsletter and get model railroad news in your inbox!