during the previous week I had time to do quite some work for SaMoRa.
I first ported the existing code to our new STMF207VE. In order to do this, I had to create the corresponding linker script and to patch ChibiOS (or more precisely, to hack it) in order to use TIM11 on our board. I also made the CAN implementation of the HAL avalaible for the STM32F2XX family.
I also finished the implementation of most of the OpenLCB standards we will use. This includes most of the Data Link and Network layers, the datagrams and events protocols from the Transport layer and the train control protocol from the Application layer. The CAN specificities are also taken care of. The specific control messages are used and the OpenLCB messages are translated in both ways. The only problem is the translation of messages from nodes not on the CAN. The bridge at the entry of the CAN should automatically create new aliases to send them on the CAN. It was considered unpractical and not useful for our use so they use the alias of the bridge. Furthermore, as some things were not exactly defined, I had to decide on some points. So, even if the code is compliant with the spirit of the standard, it may not work well with another OpenLCB implementations. We finally asked for a range of adresses and received it instantly. We now have the 220.127.116.11.10.(0-255) ID range. It allowed us to determine the exact IDs for all our cards and the exact events we will generate, both for controlling the lights and for receiving information from the sensors.
Next on line is the controller. Based on the file describing the layout of our rails, a python script now generates all the required structures. These structures contain all the necessary information in a usable format, creating an oriented graph with some extra information in independent arrays. The actual implementation of the controller manages all the locomotives, given a complete path for each one (an empty one is valid). It takes care of the reservation of all the segments and switches necessary to a given traject and so prevents crashes. Anyway, that’s the theory, as our railroad is actually unavailable and so the software is untested.
Finally, Guillaume was able to run a program compiled with the -fpic option and launched from his bootloader. Below is an example of blinking LEDs with a program put at address 0×1000.