11 abril 2013

RPICD: RPIC with daemon

Category: Electrónica,Raspberry pi,Rocrail — Manolo @ 21:52

After checking in the forum of rocrail, I have moved from the original idea of having everything package in the rocpi library  to a more HW independent approach.

In this new version, the rocpi library is just forwarding the commands through a TCP connection to the RPIC daemon, which is the one interfacing the GIPO in the raspberry pi and the serial port to access the ucontroller.

In this way rocrail can actually run on the raspberry –as it is my intention – or in any other platform, leaving the daemon the responsibility to interface the HW.

The firmware in the ucontroller has not changed from the previous post… Yeah, and I need to create a repository and a page to gather all the info related to the rpi.

9 abril 2013

RPIC, raspberry pi, rocrail and rocpi!!!

Category: Electrónica,Raspberry pi,Rocrail — Manolo @ 20:54
For the last version, visit always: http://tren.enmicasa.net/railpic

In the last weeks I have been working on a new approach to use the raspberry pi and rocrail: RPIC.

The raspberry and PIC (RPIC) is a very basic electronic circuit to have a multiprotocol central station running in the raspberry pi.

rpic

RPIC is basically code running on a Microchip microcontroller (currently a pic16f1825)

The main motivation to produce this firmware has been the failure in making DDX running on the rpi (http://forum.rocrail.net/viewtopic.php?t=4763). In the best scenario, the rpi was capable of use ddx through an usb adaptor, consuming a considerable amount of resources in the raspberry.

Thus, and inspired by the MDRRC Digital RailRoad Control by Robert Evers (http://vhaenchen.homepage.t-online.de/mdrrc/mdrrc.html), I decided to develop my own ucontroller central station.

Yes, it is yet another solution for managing model trains. The main difference with other solutions is that rpic is born to be used jointly with rocrail and the raspberry pi. Of course, with the right HW adaptor, it could be used with other platforms, and with the right protocol, it could be also used by other pieces of SW… but for that purposes there are already many available solutions. The objective was to complement the raspberry pi with the minimum pieces of HW to get a full control center.

RPIC works together the rocpi library created for rocrail. There are basically two modes of use: as an auxiliary command station, or as the main command station.

RPIC as auxiliary command stations

The rocpi library can be used as a secondary station to make use of the GPIO port of the raspberry pi. In this case, the ucontroller and max3232 of the schematic, can be removed.

In the current version, what the user will obtain is:

  • A led informing the daemon is up and running or not
  • A button to reset the daemon (short pulse) or turn off your raspberry pi (pressing the button for more than 4 seconds).

RPIC as main command stations

The current features included in the firmware are:

  • Support for MM1 and MM2 protocol
  • Support for NMRA (long and short addresses) – 14,28 and 128 steps
  • Support for NMRA accessories (no extended accessories so far)
  • Support for writing CV.

There are some other eastern eggs – as the capability to generate MFX messages). The development is not completed and coming features include:

  • Full support to reading and writing cvs, only on the main
  • Segregated programing track (PT), with the possibility to run both the trains and send commands to the PT.
  • MM accessories, MM1Fx and the special protocols MM3, MM4 and MM5 available in ddx (under demand)
  • Capturing of power consumption from ORD-2 and ORD-3 boosters.
  • At least complete the research on MFX

As usual I am releasing all the code and updating the manual:

  • rpic firmware (and also the compiled file)
  • rocpi source code. Just extract the content in your rocrail source code folder and compile. I will be requesting to the rocrail community to accept this contribution and include it in the usual distribution packet
  • rocrail-4981-wheezy-armhf. A compiled version of rocrail with the rocpi library.
  • rocrail_save. An example of the rocrail.ini file and the daemon scripts
  • Setting up rocpi_v1.5. The updated version of the «book»

Next weekend I will try to prepare a specific page in the web-site to gather all the information related to the raspberry pi and rpic. And of course a good PCB coming soon.

IMG_0050p

26 febrero 2013

Rocrail and RPI… still

Category: Electrónica,Raspberry pi,Rocrail — Manolo @ 21:50

Just a quick finding:

DDX with only DCC is not managing to send the idle packet….

DDX with MM activated does  😯

I have made the test with the option of MMLP (long pause for motorola)… and still, the idle packet is sent.., but the normal packets (in the experiment for loco 23) is never sent.

24 febrero 2013

Rocpi and serial port

Category: Electrónica,Raspberry pi,Rocrail — Manolo @ 20:47

I have been trying to find out why the ttyAMA0 port is not working with rocrail.
So far, I have not found the answer… but it is clear that the port generates with no problem the Motorola packets, but not the dcc ones.
I have been capturing the output with the oscilloscope and decoding them, with only dcc active… and including one loco and no loco.
The outcome should be the idle packet as sent by rocrail:
11111111111111101111111100000000001111111110
When I used an USB converter, that is precisely what is obtained…now, when I used the AMA0 port… it seems not being able to generate even the right bit code:
In the picture: 11X…

20130217_513648

After two 1 received… there is a weird signal… neither a ‘1’ nor a ‘0’
I have also tried to measure directly from the GPIO pins… and the results are the same – discarding any problem with the board I prepare to adapt the voltage levels.

20130217_512849

So next step… see if the problem is in the way rocrail manages the serial port… or if it is just a problem with the AMA0 port – for that I would need some help form the rocrial community.
PS:I have made test to send a file of 2MB at the baudrate used to generate dcc packets… and it arrived with no problems to my PC.