Left to Right: Walter Nakano, Wendell Pereira da Silva, Joel Sherrill and Jennifer Averett |
Recently, OAR got to host Wendell Pereira da Silva and Walter Nakano from COMPSIS for two weeks of intense development activity. Their system consisted of an embedded PC plus some add-on boards which added up to a lot of individual pins and ports to test. They brought a LabView test right which allowed us to test every input and output on the Multi-I/O board.The hardware list was:
- RTD CME137686LX Embedded PC
- 4 COM ports and i82551 NIC of particular interest to their project
- RTD 17320HR Octal UART PC-104 board (PCI interface)
- Exar PCI Vendor Id with 8 NS16550 compatible serial ports
- NOTE: We only had one of these boards but they will have 4 in the real configuration!!
- RTD 316HR Dual Synchronous Serial Port PC-104 board
- single Zilog Z85230
- RTD 6425HR Multi-I/O PC-104 board
- 16 differential or 32 single-ended analog input channels
- 4 analog output channels
- 32-bit discrete I/O with 16 bit programmable for interrupt on input change
COM1 and COM2 worked as soon as the cabling was correct. COM3 and COM4 proved more difficult. After struggling to find a software problem, it occurred to me that it could be as simple as RTS/CTS not being wired together in the shell since we were using a 3-wire connection. That was indeed the problem. Next came the octal serial port board.
After realizing that we would end up with a libchip configuration table with 38 entries and most of them would be disabled for "normal" configurations, I had the idea to allow for dynamic registration of new "ports" in the libchip configuration table. The idea is that if you probe for a bank of 8 serial ports and find them, then you can dynamically add 8 more entries to the libchip configuration table. Currently this allows probes to insert entries prior to console_initialize() being called. It is possible to allow them to be registered after this point but they would not be available to be /dev/console or used for printk().
While I was implementing dynamic registration, Jennifer and our guests worked to get the PCI probe to find the card and the first serial port working. We were surprised to learn that it didn't have a vendor Id of RTD but Exar. This explained the sparse programming documentation from RTD. As soon as the probe and one serial port worked, we switched to my dynamic registration code. Soon all eight ports on the board we had were working. Plus I added code to detect the 2, 4, and 8 port variants of the Exar chip.
Next was the dual port synchronous board. Unfortunately, RTEMS does not have a Z8530 synchronous driver but does have a standard libchip asynchronous driver. After fiddling to figure out the baud rate clock divisor math, we ended up with both ports working. There was one issue in the driver we did not resolve in the two weeks they were here. The two ports on a Z8530 share a single interrupt status register which when read, clears the source. You have to be extremely careful to touch it one time and process all interrupt sources on both ports. The ports worked individually but not when both were installed. Jennifer and I had a solution but not enough time to implement it. Hopefully Wendell and Walter can implement it and we can get this resolved in the main tree.
Next was the Multi-IO board. If you have been following my blog a while, then you might remember the entry RTEMS Shell as Debug Aid where I discussed adding commands to the RTEMS Shell to aid in debugging a Winsystems Multi-IO board similar in capability to this board. One of the last things Jennifer and I had done to the existing multiio was to define a board independent interface between the shell commands and the actual driver. My plan was to let this interface evolve and grow as we learned more about user application requirements. This was the first opportunity we had to write a driver to this interface and reuse the commands. As might be expected, there were places where 0/1 based numbering of inputs still reflected the Winsystems board. And there were places in the RTD documentation that were unclear. But after a while of fighting these and the normal cabling issues, we were able to use the existing commands to debug the driver and verify that all discrete I/Os to work polled and interrupt driven and that all analog inputs and outputs work polled. We ran out of time before we were able to attempt analog input interrupts.
The final thing we attempted was getting the RTEMS TCP/IP stack to run on this board. It had an Intel i82551ER NIC which required using the drivers in the libbsdport kit of late model FreeBSD drivers. This driver works on qemu when you configure qemu for the i82559 simulation. We verified the basics were OK on qemu. Then we moved on to the real hardware. After the normal hunt for an extra cable and battle of the network settings, we were able to run the telnetd application from the network-demos module.
Walter and Wendell drove their hardware. Jennifer and I were the main forces driving the code but they reviewed every line of code and we all verified that each line of code programmed the hardware as we all agreed it should be. Along the way, if something was unclear, we took a break from coding and testing to focus on a portion of the RTEMS Open Class that was very specific to what we were working on. The goal was not only to have as much functional code as possible; it was also to ensure that the code was high quality and they left understanding it and capable of modifying it should the need arise.
At the end of two weeks, we all were thrilled. Walter and Wendell had been sending home progress reports and every day I continued to be amazed at the progress we -- as a team -- had made. This amount of progress was possible because each of us brought unique skills and knowledge to the table. Jennifer and I knew where to reuse code from in RTEMS and how to create an elegant solution the RTEMS way. Walter and Wendell were intimately familiar with their hardware and test equipment and ensured we tested well. Together we reviewed all code to ensure they left understanding it.
I really enjoy teaching the RTEMS Classes but RTEMS Pair Programming is one of the most fun and personally rewarding services we offer. I always come away amazed at how much is working at the end of an intense 2-3 week development sprint. By bringing together engineers with complementary skills and knowledge, solutions are found quicker. And solutions are ultimately what we all want.
Thanks to Walter, Wendell and Daniel who couldn't make the trip for two weeks of fun and productive work.
No comments:
Post a Comment