Changes To OASIS3 Software August 9-20, 2004 Bob Herlien I spent most of these two weeks debugging the problem with the SPI bus. Actually, pinpointing it to SPI took the better part of a week, during which time I wrote a number of debug and diagnostic routines, under the assumption that it was a software problem. During the 2nd week, I spent a lot of time helping Craig Okuda look at the SPI signals, while running the SPI error capture software that I also wrote during this time (see SPI TESTING SOFTWARE below). But in between times, I also made some changes to the O3 software. USER INTERFACE COMMANDS ADDED PIO - Show the states of the PIO bits #ifdef DEBUG_SERIAL SERIAL - Show the state of internal TPU structures for a given serial port. Enabled only if DEBUG_SERIAL is defined. This feature is off by default, but is not TOO dangerous; I'd feel comfortable having this on in the field when necessary #endif #ifdef DEBUG_SYSTEM SYSTEM - Show the system internal lists, such as ready list, delay list, and semaphores with their pending lists. Enabled only if DEBUG_SYSTEM is defined. This command is pretty dangerous, and should NOT be enabled on a system destined for deployment. #endif #ifdef DEBUG_FREEZE FREEZE - Freeze system multitasking. When called with "Freeze 1", all tasks other than the calling task (presumably userif) are suspended. This is extremely useful in the lab for debugging, because otherwise system lists are too dynamic to trace using the "display" command. On the other hand, this command is EXTREMELY DANGEROUS, and should NEVER be enabled on a system destined for deployment. It suspends EVERYTHING except userif, so all sampling stops, including the radio driver. #endif #ifdef DEBUG_SPI SPI - Show the SPI error counter and error list. Only works if you're using the alternate spi routines in spitest.c. See SPI TESTING SOFTWARE below. #endif PARAMETER ADDED Blinky - Turn on/off code to blink the LED. It's on by default, but can be overridden via either the user i/f or via oasis.cfg. This was done because it generated a lot of SPI traffic, and due to SPI bus problems, would cause the EIA driver to the radio to be turned off. Now that SPI is fixed, this doesn't matter and you can run Blinky if you want. MISC CHANGES 1. Ping O3 watchdog hardware once every 30 seconds, rather than twice per second. Same reason as "Blinky" above, but now that SPI is fixed it doesn't matter. Note that the O3 watchdog has a 36 minute timeout. 2. Changed so that, at reset, it finds not only the largest log block number, but also the last record in that block. It then assumes that all the logged data has been downloaded, and starts "getdata" at the next record. Previously, after reset, it would download the last log block all over again. This change makes the first download after a reset much quicker. On the down side, it makes it more likely to miss any data that was logged after the last download but before the reset. Thus it relies more heavily on the "lost record" mechanism on shore. 3. Changes to the menu in the "DIAG" function, per Zorba's request. 4. Changes to "DP" - made sure "Pending" works, and added the amount of delay to the "Delay" status. 5. Added modules swdiag.c and swdiag.h to implement some of the extra commands noted above. 6. Minor changes to malloc.c and the "display" command, to account for increased RAM. Apparently, sometime in the last year Persistor started shipping CF2's with 1 MB of RAM, rather than 512K. (Note - we have some of each). I made changes to use the macro RAM_END_ADDRESS rather than a fixed address. This macro in turn references a variable in the PicoDOS structure BIOSGVT, which is filled in at init with the memory size. I also changed "display" to allow you to display the CPU registers in high memory. SPI TESTING SOFTWARE I wrote a version of spi.c that checks to see whether the SPI commands get to the PIO chips correctly. It does this by reading back the command after it's sent and checking the results. The error statistics can be displayed via the "SPI" user command. You can run this version of spi by doing the following: 1. Rename spi.c to 2. Copy or rename spitest.c to spi.c 3. In debug.h, uncomment the line #define DEBUG_SPI 4. Recompile and download the resulting binary. Note that this software is intended only for use in the lab, and definitely NOT in the field. This is because, while useful, it has the following problems: 1. It doubles the SPI traffic necessary to do I/O, and consequently slows down the I/O by a factor of 2. 2. It's very specific to the hardware we're using on O3 (specifically, the 7301 PIO chips) and how they're configured (daisy-chained on CPU board). It sends and extra NOP to the PIO chip after every command for the purpose of reading back the command we sent. But not every command to the 7301 can be correctly read back -- only write commands will work. Thus the software looks for the write bit that's in a specific bit position in the 7301. 3. It requires that you stuff the 74AHC125 on the first I/O card. This chip is normally absent, since we normally don't need to get data back from the PIO chip on the I/O card. But we stuffed this chip on the first I/O card for testing. In fact, the spitest.c software only tries to do this on the first I/O card, not cards 2-4, because that's all we stuffed. 4. The code is messy. I had to write an intermediate software layer just above the lowest hardware-driving layer, to call the lower layer twice and check the result. This made it very inconvenient to do this via #ifdef's in the main code (spi.c).