summaryrefslogtreecommitdiff
path: root/src
Commit message (Collapse)AuthorAge
* Make ao_log_data re-entrant as it is used for both sensor and GPS logsKeith Packard2010-07-28
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Because ao_log_data is called from two different threads, failing to make it re-entrant would cause the 'log' pointer parameter to get overwritten if another thread asked to log data while the eeprom was busy writing out a block. This would cause the second thread to re-writing data from the first thread's address, but without re-checksumming the data as the checksum is computed before the log mutex is taken. The bug can be seen by log blocks with invalid checksums. Here's what happens with the ao_gps_tracking_report and ao_log threads: ao_gps_tracking_report ao_log Writes a bunch of records *blocks* in the eeprom flush sets ao_log_data 'log' to global 'log' computes checksum for 'log' block *blocks* on ao_log_mutex Wakes up sets ao_log_data 'log' to 'gps_log' writes remaining records 'gps_log' is left with svid = 0 *blocks* on ao_gps_tracking_data writes data, reading from the current ao_log_data 'log' pointer which points at 'gps_log' Making ao_log_data re-entrant fixes this by ensuring that the 'ao_log' thread has its own copy of the ao_log_data 'log' parameter. I made this function take an __xdata restricted pointer so that it could be passed in the dptr register instead of needing to go on the stack. Signed-off-by: Keith Packard <keithp@keithp.com>
* When the EP0 IN buffer is full, don't panic, just skip sending anotherKeith Packard2010-07-26
| | | | | | | | | | If the host doesn't pull the IN packet out of EP0 before sending another SETUP command along, the IN buffer will still be busy when we try to reply to the SETUP command. While I don't quite understand why this would ever happen, there's no need to panic about it, just drop the reply packet on the floor. Signed-off-by: Keith Packard <keithp@keithp.com>
* Switch DBG pins to GPIO when using any debug commands. Reboot to restore.Keith Packard2010-07-14
| | | | | | | | | | | | If you want to use TeleMetrum as a debug dongle, you need to flip the three pins used to talk to the remote debug port from SPI mode to GPIO mode. This patch doesn't provide any way to get back to SPI mode, so you'll have to reboot the TeleMetrum to write out config parameters or log flight data after using any debug commands. Signed-off-by: Keith Packard <keithp@keithp.com>
* Telemetry code was mis-computing RSSIKeith Packard2010-07-14
| | | | | | | The RSSI data from the hardware reports in 1/2 dBm increments, and so must be divided to report plain RSSI numbers. Signed-off-by: Keith Packard <keithp@keithp.com>
* Abort any in-progress radio operation when changing radio channelKeith Packard2010-06-21
| | | | | | | | | In monitor mode, the current receive operation must be aborted so that the radio channel change can take effect without receiving a telemetry packet on the old channel. Aborting any in-progress radio operation will make sure that happens. Signed-off-by: Keith Packard <keithp@keithp.com>
* Add special code for USB panic's.Keith Packard2010-06-16
| | | | | | | | The USB system may panic if the hardware isn't ready for IN data when the driver thinks it should be. This adds a special panic code to make figuring this out easier. Signed-off-by: Keith Packard <keithp@keithp.com>
* Revert "Merge remote branch 'remotes/origin/fix-reset'"Bdale Garbee2010-05-06
| | | | | | | This reverts commit 314d27a73c903fef2968dabac3d5313573713460, reversing changes made to fa77db2ffd8a749c93767db5a6311131e00473ae. For whatever reason, this is utterly not doing the right things today!
* Don't change dbg clock while changing reset_n. Use 20ms everywhereKeith Packard2010-05-05
| | | | | | | | This changes the reset code to be more conservative about changing things at the same time, and also sets all timings to 20ms to make debugging with the scope easier. Signed-off-by: Keith Packard <keithp@keithp.com>
* Use ao_delay to sleep for 2 seconds instead of trying ao_sleepKeith Packard2010-05-05
| | | | | ao_sleep doesn't delay for a specified time interval as much as one might want it to.
* Fix all stdio reading functions to be __criticalKeith Packard2010-05-05
| | | | | | | Oh, right SDCC has '__critical' to mark sections of code that need to run with interrupts disabled; no need to use EA = 0 and EA = 1. Signed-off-by: Keith Packard <keithp@keithp.com>
* Disable interrupts while reading from stdinKeith Packard2010-05-05
| | | | | | | | | | | | With multiple input source support, there is a lag between asking a device if it has data and then waiting for more data to appear. If an interrupt signalling additional input arrives in this interval, we'll go to sleep with input available. This patch uses a big hammer by just disabling interrupts for the whole process. Signed-off-by: Keith Packard <keithp@keithp.com>
* Revert "Add optional 's' command to packet slave to enable/disable slave mode"Keith Packard2010-05-04
| | | | | | | This reverts commit e7dc7fab787df63a4de72c8450e94092eb04d7db. This patch didn't work, and magically appears to break flashing TM from TD.
* Add optional 's' command to packet slave to enable/disable slave modeKeith Packard2010-04-22
| | | | | | | This option has been selected for teledongle so that you can use slave mode and hook two teledongles together over the RF link. Signed-off-by: Keith Packard <keithp@keithp.com>
* Increase reset switch time to 100msKeith Packard2010-04-10
| | | | Signed-off-by: Keith Packard <keithp@keithp.com>
* Only have the slave return a packet if it received one.Keith Packard2010-04-09
| | | | | | | | | | | When the receive is aborted to switch modes, it's important to not immediately re-acquire the radio and try to send a packet as the aborting thread won't know to kick the receiver again. This prevents the 'C' command from locking up as it tries to stop the packet slave before turning on the transmitter. Signed-off-by: Keith Packard <keithp@keithp.com>
* When changing RESET line, delay 20msKeith Packard2010-04-08
| | | | | | | | | | | The GPS data sheet suggests a 1uF cap on the reset line to ensure it is held low long enough for the power supply to come up to voltage. TM v1.0 loads a 0.001uF cap there, but in case that isn't large enough, it could be replaced with the larger one. This change makes sure that even with that larger value, the debugging link will be able to reset the target. Signed-off-by: Keith Packard <keithp@keithp.com>
* Tasks may move in task structure as a result of ao_exitKeith Packard2010-04-06
| | | | Signed-off-by: Keith Packard <keithp@keithp.com>
* Switch TeleMetrum from v0.2 to v1.0Keith Packard2010-04-04
| | | | Signed-off-by: Keith Packard <keithp@keithp.com>
* Don't abort the radio when enabling telemetry monitoringKeith Packard2010-04-04
| | | | | | | If telemetry monitoring is already on, then there isn't any point, and if it's not on, then presumably there isn't any radio work to abort. Signed-off-by: Keith Packard <keithp@keithp.com>
* Make ao_radio_idle keep trying to get the radio to idle.Keith Packard2010-04-04
| | | | | | | Attempting to abort a radio operation could lead to a hang if the user of the radio jumped in and started using it again before the task attempting to abort woke up. This change just keeps smacking the radio until the radio goes idle long enough to detect it.
* Fix up LED colors for each product.Keith Packard2010-02-27
| | | | | | | | Different products assign different color LEDs to the two available LED drivers (P1_0, P1_1). Make the LED color pin assignments per-product (in ao_pins.h), then deal with not always having a green LED. Signed-off-by: Keith Packard <keithp@keithp.com>
* Eliminate deadlock when writing config from radio linkKeith Packard2010-02-27
| | | | | | | | | | | | Writing the 'Saved\r\n' string would fill the packet buffer and cause a flush to occur, which would need to wait for the radio link to receive and transmit a packet. The radio link always re-fetches the radio channel number when lighting up the radio, so it need to look in the config space. If the config mutex was held by the config writing process while the radio was trying to get the channel number, then we'd get a deadlock. Signed-off-by: Keith Packard <keithp@keithp.com>
* Leave .ihx files in the build directory too - easier to debug that wayKeith Packard2010-02-27
| | | | | | | sdcdb wants the .ihx and .cdb files in the same directory, so humor it by copying the .ihx files to the src directory instead of moving them. Signed-off-by: Keith Packard <keithp@keithp.com>
* Must install .map files for ao-load to workKeith Packard2010-02-20
| | | | | | | ao-load uses the .map files to rewrite the serial number and other config parameters into the program flash. Signed-off-by: Keith Packard <keithp@keithp.com>
* Add back stack size checking to altos linking phaseKeith Packard2010-02-20
| | | | | | | This verifies that the stack start specified during the compile will work with the resulting program Signed-off-by: Keith Packard <keithp@keithp.com>
* Quiet make output.Keith Packard2010-02-20
| | | | | | | This borrows ideas from the notmuch project to reduce the command line clutter seen when compiling or linking stuff. Signed-off-by: Keith Packard <keithp@keithp.com>
* Update .gitignore filesKeith Packard2010-02-20
|
* Change altos build process to support per-product compile-time changesKeith Packard2010-02-20
| | | | | | | | This creates per-product subdirectories and recompiles everything for each product, allowing per-product compile-time changes for things like peripheral pin assignments and attached serial devices. Signed-off-by: Keith Packard <keithp@keithp.com>
* Change barometer conversion code to shrink conversion tableKeith Packard2010-02-20
|
* Log GPS data on pad after boost detect.Keith Packard2010-02-13
| | | | | | | | | This wakes up the two GPS reporting tasks and gets them to report out any existing GPS data to the log file. To make sure the timestamps in that GPS data are accurate, this also records GPS time on receipt of the GPS data instead of when that is logged. Signed-off-by: Keith Packard <keithp@keithp.com>
* Missing ao_mutex_put in gps_dumpKeith Packard2010-02-11
|
* Switch to using internal cc1111 temperature sensorKeith Packard2010-01-10
| | | | | | | | v0.2 has no temperature sensor, and several of the v0.1 boards didn't get a temperature sensor loaded. Use the internal temperature sensor on the cc1111 in all cases instead. Signed-off-by: Keith Packard <keithp@keithp.com>
* Force idle mode by shorting the SPI clock to ground at boot time.Keith Packard2010-01-09
| | | | | | | | This allows you to override the flight mode detection code in case the accelerometer calibration is broken somehow. Hold the SPI clock shoted to ground until the LED comes on, then remove it. Signed-off-by: Keith Packard <keithp@keithp.com>
* Add simple gps dump command 'g'Keith Packard2010-01-09
| | | | | | | This just dumps out the data in a very simple format to verify the GPS receiver. Signed-off-by: Keith Packard <keithp@keithp.com>
* Remove flash debugging printfsKeith Packard2010-01-09
| | | | Signed-off-by: Keith Packard <keithp@keithp.com>
* Don't set ao_flash_setup_done until we're actually done.Keith Packard2010-01-09
| | | | | | | Because we're accessing this variable outside of the mutex, we need to make sure it isn't set until the data it covers has been initialized. Signed-off-by: Keith Packard <keithp@keithp.com>
* Dump config block from read/write config and flash_status commandsKeith Packard2010-01-09
|
* Dump more flash parameters for the flash_status commandKeith Packard2010-01-09
|
* Add 'f' command to display flash status register contentsKeith Packard2010-01-09
| | | | Signed-off-by: Keith Packard <keithp@keithp.com>
* Add at45db161d.h header file for new flash part.Keith Packard2010-01-09
| | | | | | Forgot to add this when I added the driver. Signed-off-by: Keith Packard <keithp@keithp.com>
* Remove green LED and temp sensor from v0.2 codeKeith Packard2010-01-09
| | | | Signed-off-by: Keith Packard <keithp@keithp.com>
* Add AT45DBxx1D driverKeith Packard2010-01-09
| | | | | | | This driver supports the AT45DB011D through AT45DB321D DataFlash parts as found in TeleMetrum v0.2 Signed-off-by: Keith Packard <keithp@keithp.com>
* Remove dbg driver code from telemetrum/teledongleKeith Packard2009-12-19
| | | | | | | | The only board with debug outputs is the TI dongle at this point, so the debug modules were disabled in TM and TD some time ago. Unfortunately, the code was not removed then. Signed-off-by: Keith Packard <keithp@keithp.com>
* Ensure that ao_alarm waits at least the specified timeKeith Packard2009-12-19
| | | | | | | Because the timer tick may happen soon, it's important to delay by another tick to ensure that we don't wake up early. Signed-off-by: Keith Packard <keithp@keithp.com>
* Disable monitor mode before attempting radio test.Keith Packard2009-12-19
| | | | | | | If monitor mode is left active, then the radio lock will not be able to be acquired for the radio test. Signed-off-by: Keith Packard <keithp@keithp.com>
* Use ao_radio_get/ao_radio_put in packet code.Keith Packard2009-12-19
| | | | | | | | The ao_radio_get function both acquires the mutex *and* configures the radio channel and frequency. Failing to use this in the packet code would leave the radio frequency unconfigured. Signed-off-by: Keith Packard <keithp@keithp.com>
* Add --cal to man pageKeith Packard2009-12-15
|
* Allow radio calibration to be set from ao-loadKeith Packard2009-12-05
| | | | | | | | This moves the initial radio calibration value into const memory where it will be used if no eeprom configuration value is available, either on an unprogrammed board with eeprom or a device without an eeprom. Signed-off-by: Keith Packard <keithp@keithp.com>
* Re-order config values. Change frequency to calKeith Packard2009-12-05
| | | | | | | Place more often used values at top, and consistently call the radio value 'calibration' instead of 'frequency'. Signed-off-by: Keith Packard <keithp@keithp.com>
* Add radio calibration configuration.Keith Packard2009-12-04
| | | | | | | | | The crystal we use is only good for 20ppm, which generates a fairly significant error bounds at our RF frequency. This commit adds a configuration variable that sets the RF frequency control variable so that the output frequency can be adjusted. Signed-off-by: Keith Packard <keithp@keithp.com>