claymore1977

I've been hacking away at getting the CMRI Emulation working on the Launchpad. When it comes to a standalone unit, it is currently working like a champ. Getting multiple Launchpads to talk on the same serial bus has been quite unsuccessful thus far.

Next endeavor is to use Shift registers and ramp up the number of Inputs and Outputs off of a single Launchpad. A single launchpad that handles massive amounts of IO via Shift Registers is not the most user friendly approach, however. I would prefer to either hookup multiple Launchpads via the USB ports on them, or use a single USB connection and have multiple Launchpads share the Serial bus. Both of those approaches are problematic at this time, and more research is needed. For now, I'm going to get the Shift Registers angle tackled.

Here's a link to the CSS5 project.

And here's a video:

//player.vimeo.com/video/79011551

CMRI Emulation on a Launchpad 430G2553 from claymore1977 on Vimeo.

TODO List for CMRI on Launchpad

  1. Test chaining multiple launchpads together, with different addresses, via Pins 1.1 and 1.2
  2. Increase Baud Rate higher than 9600
  3. Test multiple launchpads sharing the same address, but handling different ranges of IO bits.
  4. Clean up, consolidate and minify code.
  5. Experiment with using Shift registers to increase a single Launchpad's capability from 12 IO pins.
  6. Determine which of the MSP430G2 chips can be used besides the 'top of the line' 2553
  7. Develop more advanced CMRI nodes other than simple On/Off command and sensing.

 

Latest and Greatest updates on my experiments with JMRI, CMRI and the Launchpad are on TheRustySpike.com

Cheers!

-Dave L

----

Dave L

http://therustyspike.com/

"A penny for your thoughts, but you get to put your two cents in.... hey, someone's making a penny!"

Reply 0
Yaron Bandell ybandell

Shared serial bus

Dave,

I would use the RS232 logic ports on the Launchpad and transform it in a RS485 (if I recall the number correctly) shared serial bus. Way easier and the hardware will help ensure proper timing of the output signals etc. Wasn't LocoNet a form of RS485 serial bus?

I'll have to finish my 3V & 5V power "pack" circuit so I can test out my Launchpad servo controller code with real servos instead of having it flash the onboard LED. I can then sequence some animations with it.

Reply 0
Utrainia

RS485

Hi Dave,
 
You'll need to use RS485 to talk to more than one node, as JMRI has a limitation and can only address 1 CMRI bus at a time; it is unable to have multiple USB connections to different CMRI nodes.
 
So since you can only use one bus/connection, you need to place multiple nodes on that bus instead. This is where RS485 comes in.
 
I'm not sure what version of the ArduinoCMRI library you're using, but the October 20th release of ArduinoCMRI adds support for RS485 and multiple nodes on one bus. I know it says "Arduino" in the name but the code runs under Energia too so LaunchPads are supported.
 
I have written a blog post about hooking up multiple Arduinos to an RS485 bus, see http://www.utrainia.com/65-arduinocmri-and-rs485 for more details.
 
Here are three Arduinos hooked up to an RS485 bus, each one driving its own LED and talking back to the JMRI master.
 
Quote:
Test multiple launchpads sharing the same address, but handling different ranges of IO bits.
Unless these nodes are purely output nodes, I think you will run into problems when JMRI polls them for their input bits, as you'll have multiple nodes trying to answer to the same name, but with differing data. Since there is no limit to the number of nodes you can set up in JMRI (I've tested up to 64 nodes!) there is no reason not to give each one a unique address.
 
Quote:
Experiment with using Shift registers to increase a single Launchpad's capability from 12 IO pins.
You might be interested in another blog post I've written on this topic, where I use shift registers to expand both the outputs and inputs:  http://www.utrainia.com/45-addressing-many-leds-with-a-single-arduino
 
Quote:
Develop more advanced CMRI nodes other than simple On/Off command and sensing.
Sky is the limit really! I've made a simple crossing flasher that does the all timing on the Arduino (just send it crossing-on and crossing-off commands and it does the rest), and have also made nodes that use lasers and reversed LEDs to make a "whatever I had on hand" optical train sensor. Servos for turnout control are another easy application.
 
Keep up the good work, good to see my code on MSPs as well... not a development I ever invisaged!
 
Cheers,
Michael.
 

Check out my N scale blog: http://www.utrainia.com

Reply 0
claymore1977

Yaron and Michael

Yaron:  I have been trying to avoid the need for adding USB-> RS485 hardware as I am shooting for a nearly plug and play solution that involves the minimum amount of pieces possible.  My target demographic are those modelers who want a 'plug and play' solution.  I've still got a few ideas to kick around, but thanks for helping confirm that rs232, as it's used on the Launchpad, will likely not cut it.
 
Michael:  The limitation with JMRI is something I'm thinking about diving in a fixing, if I can.  That would eliminate the need for a dedicated 485 bus altogether and accomplish my easy 'plug n play' goal. (At the expense of a LOT more USB cables!)
 
As for the version of the ArduinoCMRI lib, I dunno. I used some snippets of your code and the rest as a reference to understand a few nuisances about the CMRI proto. (Excellent implementation, BTW)   I needed to get the code compiling in Code Composer Studio rather than Energia, so I had to do a complete rewrite of everything in raw C, rather than C++.  This project is also a bit old now, as I've made many many more changes but have been amis in updating my blogs
 
One issue I noted, and this may be a hardware limitation of the MSP430 not seen on an Arduino, is the cmriTransmit() function.  This call essentially blocks until an entire CMRI message is sent to the PC.  Normally not an issue, but when you try to run a PWM based on interrupts and timers at the same time as CMRI comms, the timing of the PWM is thrown off by the transmit() blocking time, resulting in very jittery LED illumination.  Not a difficult fix, but required moving the cmriTransmit() functionality into the main loop and only transmit a single byte per loop pass, to minimize the blocking effects.
 
It seems you and I have similar goals and implementations  I've crawled all over your site already, great stuff!
 
I've already successfully chained to 74hc595s together to get a 16 output setup, as well as used the two registers in an 8x8 matrix to get 64 outputs... Next I am going to attempt a 16x16, but I'm not sure I've got enough breadboards for that!
 
I haven't been posting much here as I know it's already done by many and likely of little use to most, but I guess I'll bleed more of my blog posts onto here.
 
Cheers!
 

----

Dave L

http://therustyspike.com/

"A penny for your thoughts, but you get to put your two cents in.... hey, someone's making a penny!"

Reply 0
Yaron Bandell ybandell

keep them blog posts coming!

Dave, just keep the blog posts coming. They inspire me to do that extra bit of effort in getting animation ideas for my future layout.

Reply 0
Reply