| Commit message (Collapse) | Author | Age |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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>
|
|
|
|
|
|
|
|
|
|
| |
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>
|
|
|
|
|
|
|
|
|
|
|
|
| |
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>
|
|
|
|
|
|
|
| |
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>
|
|
|
|
|
|
|
|
|
| |
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>
|
|
|
|
|
|
|
|
| |
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>
|
|
|
|
|
|
|
| |
This reverts commit 314d27a73c903fef2968dabac3d5313573713460, reversing
changes made to fa77db2ffd8a749c93767db5a6311131e00473ae.
For whatever reason, this is utterly not doing the right things today!
|
|
|
|
|
|
|
|
| |
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>
|
|
|
|
|
| |
ao_sleep doesn't delay for a specified time interval as much as one
might want it to.
|
|
|
|
|
|
|
| |
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>
|
|
|
|
|
|
|
|
|
|
|
|
| |
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>
|
|
|
|
|
|
|
| |
This reverts commit e7dc7fab787df63a4de72c8450e94092eb04d7db.
This patch didn't work, and magically appears to break flashing TM
from TD.
|
|
|
|
|
|
|
| |
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>
|
|
|
|
| |
Signed-off-by: Keith Packard <keithp@keithp.com>
|
|
|
|
|
|
|
|
|
|
|
| |
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>
|
|
|
|
|
|
|
|
|
|
|
| |
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>
|
|
|
|
| |
Signed-off-by: Keith Packard <keithp@keithp.com>
|
|
|
|
| |
Signed-off-by: Keith Packard <keithp@keithp.com>
|
|
|
|
|
|
|
| |
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>
|
|
|
|
|
|
|
| |
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.
|
|
|
|
|
|
|
|
| |
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>
|
|
|
|
|
|
|
|
|
|
|
|
| |
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>
|
|
|
|
|
|
|
| |
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>
|
|
|
|
|
|
|
| |
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>
|
|
|
|
|
|
|
| |
This verifies that the stack start specified during the compile
will work with the resulting program
Signed-off-by: Keith Packard <keithp@keithp.com>
|
|
|
|
|
|
|
| |
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>
|
| |
|
|
|
|
|
|
|
|
| |
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>
|
| |
|
|
|
|
|
|
|
|
|
| |
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>
|
| |
|
|
|
|
|
|
|
|
| |
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>
|
|
|
|
|
|
|
|
| |
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>
|
|
|
|
|
|
|
| |
This just dumps out the data in a very simple format to verify the GPS
receiver.
Signed-off-by: Keith Packard <keithp@keithp.com>
|
|
|
|
| |
Signed-off-by: Keith Packard <keithp@keithp.com>
|
|
|
|
|
|
|
| |
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>
|
| |
|
| |
|
|
|
|
| |
Signed-off-by: Keith Packard <keithp@keithp.com>
|
|
|
|
|
|
| |
Forgot to add this when I added the driver.
Signed-off-by: Keith Packard <keithp@keithp.com>
|
|
|
|
| |
Signed-off-by: Keith Packard <keithp@keithp.com>
|
|
|
|
|
|
|
| |
This driver supports the AT45DB011D through AT45DB321D DataFlash
parts as found in TeleMetrum v0.2
Signed-off-by: Keith Packard <keithp@keithp.com>
|
|
|
|
|
|
|
|
| |
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>
|
|
|
|
|
|
|
| |
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>
|
|
|
|
|
|
|
| |
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>
|
|
|
|
|
|
|
|
| |
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>
|
| |
|
|
|
|
|
|
|
|
| |
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>
|
|
|
|
|
|
|
| |
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>
|
|
|
|
|
|
|
|
|
| |
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>
|