Skip to main content

Replies sorted oldest to newest

RS232.  I believe it is 115.2 Kbaud.  You should sign up as a LCS developer to get Lionel's PDI protocol specification which details the PDI framing that encapsulates the serial PDI commands.  The LCS Ser2 device strips the PDI framing and provides you with TMCC and TMCC2 commands in/out the DB9 at 9.6 Kbaud.  I recommend you explore the PDI commands via a socket to the LCS Wifi address, port 50001.  The packets do not include the PDI serial framing which makes decoding the command stream easier.

Should you want to connect directly to the PDI serial I/O, you will need to fabricate a DB-9 to serial cable.  The PDI cable color codes are listed in the attached diagram:

 

Attachments

Images (1)
  • SER2 PDI: LCS2 and PDI cable

My memory is the packets are ascii encoded hex when received or sent thru the wifi with possible stuff bytes and checksum scenario.   Or you can look in the books which they will send you if you sign up and are pretty clear over all.

I wrote my test code in java which is not perhaps ideal for bit twiddling but worked... 

 

Multidrop RS232 worked well in a project I worked 3 decades ago ... as long as the distance/voltage drop was with the I/O chip's ability to sense the bits.  The LCS system fits within those distance parameters.

Lionel's developer documentation does not cover the hardware interfaces - just the protocols.  The PDI serial baud I stated is based on a comment I heard at one of the York LUG meetings (attributed to Jon Z).  I gather that Lionel does not want developers to connect directly to the PDI cable as a poor implementation can cause havoc on the PDI bus.   The WiFi connection is the best interface for applications that use the full PDI protocol.  Note that the PDI protocol is a superset of TMCC/TMCC2 commands.  If your intent is limited to read/write TMCC/TMCC2 commands, then the Ser2 DB9 serial connection is fine.

The wifi though gets you the base "directories" -- engine rosters and all that.  Maybe you can do that through the SER2, not entirely clear to me.   It seemed like somewhere it said in the docs that you get maximum knowledge through the wifi connected to the base.  Could well have changed or be wrong...  (Now that I reconsider this post -- perhaps its that you can update the base through the wifi only ... but read the base otherwise?  That sounds a bit on the right side of things...)

I will just add that if you have done this kind of thing before, it's not that bad ... everything I tried did work & the docs are reasonable enough but I didn't come close to implementing all the TMCC1 or TMCC2 of which there are many many commands ...

I was able to control 3 engines in a basic way (thru some very simple gui controls I gen'd up ) and read the sensor track packet and display that info.

I was also able to read the base and get my engine roster...  and put that in a "pick list" so to speak.

Still, a long way to go before anything solid in my mind ... and I hope to go back to this sometime, maybe over the summer perhaps.

John... checkout High Rail for an example of some cool ideas that can be built using LCS. High Rail for iPhone and iPad provides fast LCS module discovery/ connectivity, a super-simple SensorTrack recording feature, and awesome gesture-based Legacy engine control (speed, direction, quilling whistle, couplers, emergency stop, etc.). iPhone 6 and 7 users can even take advantage of 3D touch to quickly adjust momentum (similar to the CAB2 boost/brake).

From a technical perspective, High Rail 1.0 was all ObjC and C. High Rail 2.0 started the transition to Swift. High Rail 2.2 (current release) is 99.7% Swift (there's a few ObjC/ C files still lingering around). Framing the PDI messages is not difficult (just follow the steps outlined in the PDI docs provided by Lionel). At some point in the near future I plan to publish some example code describing High Rail's "command building framework", which makes it dead easy (and cheap) to build TMCC/Legacy/PDI commands using Swift structs and protocol extensions (note: examples will only show TMCC/ Legacy commands, not PDI messages/ message framing... because that's under NDA).

Here's a link to Lionel's LCS Partner site:  http://www.lionel.com/lcs/LCSPartner/index.html

The Lionel LCS Partner site contains links to the High Rail website. The site also contains links to the other Partner products. 

Good luck with your project.

Brian

Add Reply

Post

OGR Publishing, Inc., 1310 Eastside Centre Ct, Suite 6, Mountain Home, AR 72653
800-980-OGRR (6477)
www.ogaugerr.com

×
×
×
×
Link copied to your clipboard.
×
×