summaryrefslogtreecommitdiff
path: root/src/drivers/ao_cc1120.c
Commit message (Collapse)AuthorAge
* altos: Eliminate 'pin' field from GPIO functionsKeith Packard2018-10-13
| | | | | | | This was used with the 8051 bit-addressing mode to provide single-instruction access to GPIO pins. Signed-off-by: Keith Packard <keithp@keithp.com>
* altos: Make cmd number parsing functions return valueKeith Packard2018-10-13
| | | | | | Don't use a global variable to hold the result. Signed-off-by: Keith Packard <keithp@keithp.com>
* altos: Remove 8051 address space specifiersKeith Packard2018-10-13
| | | | Signed-off-by: Keith Packard <keithp@keithp.com>
* altos/ao_cc1120: Only call ao_packet_slave_stop when HAS_SLAVEKeith Packard2018-03-23
| | | | | | | Don't try to disable packet slave mode when the product doesn't support packet slave mode. Signed-off-by: Keith Packard <keithp@keithp.com>
* altos/cc1120: remove unused status from ao_radio_fifo_write_stopKeith Packard2016-08-29
| | | | Signed-off-by: Keith Packard <keithp@keithp.com>
* altos: Don't access cc1120 SPI bus during recv after abort has startedKeith Packard2016-07-27
| | | | | | | | | | When the receive timeout happens, the radio may still interrupt while the SPI bus is getting shut down. If this happens, the interrupt handler shouldn't touch the SPI bus at all as it may well be turned off, which would cause the receive function to wedge waiting for a spi byte transfer to happen. Signed-off-by: Keith Packard <keithp@keithp.com>
* Switch from GPLv2 to GPLv2+Keith Packard2016-07-12
| | | | Signed-off-by: Keith Packard <keithp@keithp.com>
* altos: Use FIFO_THR pin for cc1120 transmit bufferingKeith Packard2016-06-29
| | | | | | | Instead of reading NUM_TXBYTES, set the FIFO_THR pin to indicate when 64 bytes are available in the buffer. Signed-off-by: Keith Packard <keithp@keithp.com>
* altos/drivers: Use more reliable byte interface for CC1120 receptionKeith Packard2016-06-29
| | | | | | | This replaces direct register access with function calls to allow that code to respect the hardware requirements. Signed-off-by: Keith Packard <keithp@keithp.com>
* altos: Replace ao_alarm/ao_clear_alarm with ao_sleep_forKeith Packard2015-02-13
| | | | | | | | | | | | | | | | Having arbitrary alarms firing in the middle of complicated device logic makes no sense at all. Therefore only correct use of ao_alarm and ao_clear_alarm was around a specific ao_sleep call, with correct recovery in case the alarm fires. This patch replaces all uses of ao_alarm/ao_sleep/ao_clear_alarm with ao_sleep_for, a new function which takes the alarm timeout directly. A few cases which weren't simply calling ao_sleep have been reworked to pass the timeout value down to the place where sleep *is* being called, and having that code deal with the return correctly. Signed-off-by: Keith Packard <keithp@keithp.com>
* altos: Make sure we drop the SPI mutex when aborting cc1120 recvKeith Packard2014-09-26
| | | | | | | | | | The cc1120 receive code is 'twisty', in that it acquires the SPI mutex in the middle of an interrupt handler so that it can quickly start the radio when the signal comes in. This means we have to be careful to drop that mutex in all paths which leave the receive code, including when the packet receive is aborted mid-way through the process. Signed-off-by: Keith Packard <keithp@keithp.com>
* altos: Reduce deviation at 2400/9600 baudKeith Packard2014-09-06
| | | | | | | | | | There's no reason to use 20.5kHz deviation at 2400 and 9600 baud, and if we get a better receiver, we'll want to use narrower deviation to have less bandwidth sucking noise into the radio. The new values are (nominally) 5.125kHz deviation for 9600 baud and 1.5kHz deviation for 2400 baud. Signed-off-by: Keith Packard <keithp@keithp.com>
* altos: Rework packet receive for cc1120Keith Packard2014-07-05
| | | | | | | | | | Instead of blocking on PQT, just set up the receiver to start going and when the first bit interrupt comes in, grab the SPI bus if possible and configure it for reception. This improves sensitivity in the radio by a significant amount while making the code conceptually a bit nicer. Signed-off-by: Keith Packard <keithp@keithp.com>
* altos: Add telemetry rate support to CC1120 driverKeith Packard2014-07-05
| | | | | | This supports the new 2400 and 9600 baud rates Signed-off-by: Keith Packard <keithp@keithp.com>
* altos: Clean up -Wextra warningsKeith Packard2013-12-20
| | | | | | | Unused variables, mismatching signed/unsigned and a few other misc warnings. Signed-off-by: Keith Packard <keithp@keithp.com>
* altos: Clean up some minor warnings from -WallKeith Packard2013-12-20
| | | | | | Unused variables, functions and labels, missing enums in switch. Signed-off-by: Keith Packard <keithp@keithp.com>
* altos: Generate unmodulated carrier for CC1120 test modeKeith Packard2013-05-15
| | | | | | | This sets the deviation to 0, enables the preamble and turns on the transmitter. It will sit there happily sending a bare carrier forever Signed-off-by: Keith Packard <keithp@keithp.com>
* altos: Set APRS deviation to 3kHzKeith Packard2013-05-07
| | | | | | | | I finally found a bunch of references to APRS on the net and they all appear to assume a 3kHz deviation. Let's see if this works better with Yaesu radios. Signed-off-by: Keith Packard <keithp@keithp.com>
* altos: Make cc1120 driver return false on recv timeoutKeith Packard2013-05-07
| | | | | | Was returning an uninitialized value, which was often not zero Signed-off-by: Keith Packard <keithp@keithp.com>
* altos: Compute "real" RSSI value in radio code as neededKeith Packard2013-05-07
| | | | | | | | | Instead of dragging around the weird CC1111 RSSI values, just compute a dBm value in a signed 8-bit integer, ao_radio_rssi. Use that everywhere we need RSSI internally. We leave the weird CC1111 value in the packet reply as that's what the host expects. Signed-off-by: Keith Packard <keithp@keithp.com>
* altos: Clear any broken cc1120 TX fifo bits before transmittingKeith Packard2013-05-07
| | | | | | | | This just goes and clears the transmitter before using it, just in case it got wedged somehow. It also clears the bits while waiting for the radio to go idle, otherwise it'd never make it. Signed-off-by: Keith Packard <keithp@keithp.com>
* altos: Make cc1120 driver wait for TX finishedKeith Packard2013-05-07
| | | | | | | | | | Otherwise, we may come in and try to use the radio again too quickly, causing it to go into a TX fifo error state. This change watches the MARC status until the transmitter is explicitly marked as finished. Signed-off-by: Keith Packard <keithp@keithp.com>
* altos: Provide timeout value to ao_radio_recvKeith Packard2013-05-07
| | | | | | | | | Instead of using ao_alarm around calls to ao_radio_recv, provide an explicit timeout value as needed by radio functions with more complicated system interaction than the cc1111. The timeout is 8 bits of clock ticks. Signed-off-by: Keith Packard <keithp@keithp.com>
* altos: Get CC115L radio working.Keith Packard2013-03-29
| | | | | | | | | | | | | | | | This involved figuring out which GPIO signal would reliably indicate that the transmitter was finished; I ended up using the PA_PD bit for this. This also converts all of the radio users to the long packet support as the CC115L has only a 64-byte fifo, not large enough to hold either an RDF tone or a regular AltOS telemetry packet. This also renames the public API for sending APRS packets from ao_radio_send_lots to ao_radio_send_aprs, which is at least more accurate. The workings of that API haven't changed, just the name. Signed-off-by: Keith Packard <keithp@keithp.com>
* altos: Change CC1120 SPI speed to 4MHz.Keith Packard2013-01-13
| | | | | | | | Most of the chip can run at 8MHz, but extended register access is limited to 6.1MHz. Instead of pushing things, just run the SPI bus at 4MHz. Signed-off-by: Keith Packard <keithp@keithp.com>
* Merge remote-tracking branch 'origin/micropeak-logging'Keith Packard2013-01-10
|\
| * Allow CC1120 to sit on other SPI bussesKeith Packard2012-12-31
| | | | | | | | | | | | | | | | Reading the incoming data bypasses the SPI API and touches the SPI data register directly; which port that is needs to be specified in the pins file Signed-off-by: Keith Packard <keithp@keithp.com>
* | altos: Time out reading packet data from cc1120 after 100msKeith Packard2013-01-10
|/ | | | | | | | | | Sometimes the radio will give a spurious wakeup indicating that a preamble seems to have arrived, but no packet data will appear. In this case, abandon the packet reception and go back to waiting for a preamble again. This releases the SPI bus for other users and also avoids missing packets. Signed-off-by: Keith Packard <keithp@keithp.com>
* altos: Fix cc1120 debug code to build on megadongleKeith Packard2012-12-28
| | | | | | RDF function had changed, and APRS isn't available on megadongle. Signed-off-by: Keith Packard <keithp@gag.com>
* altos: Wire up another CC1120 GPIO to get MARC status changesKeith Packard2012-12-16
| | | | | | | | | | | | | When the radio drops out of RX or TX mode due to an error, it changes the MARC status, and sends pulse down a configured GPIO. Use this to tell when something 'bad' happened during TX or RX so that we can recover from losing the SPI bus in the middle of transmission or reception. Without this, the radio would change state and we'd never know, leaving the radio code waiting for an interrupt that would never arrive. Signed-off-by: Keith Packard <keithp@keithp.com>
* altos: Fix up APRS packet sending code in cc1120 driverKeith Packard2012-12-07
| | | | | | | | This fixes the FIFO management, ensuring that the data are streamed into the radio fast enough to keep the packet continuous. Sounds like it works, but testing with an actual APRS receiver is required. Signed-off-by: Keith Packard <keithp@keithp.com>
* altos: Hook APRS up to the radioKeith Packard2012-12-06
| | | | | | | This adds an arbitrary-length packet writing function to the radio code. Signed-off-by: Keith Packard <keithp@keithp.com>
* altos: fix cc1120 radio test - state wasn't made staticKeith Packard2012-11-18
| | | | | | so whether the radio got turned on was random. Signed-off-by: Keith Packard <keithp@keithp.com>
* altos: Switch drivers to ao_arch_block/release_interruptsKeith Packard2012-10-25
| | | | | | Stop using cli/sei, which are avr-specific Signed-off-by: Keith Packard <keithp@keithp.com>
* altos: profiling on STM32LKeith Packard2012-10-25
| | | | | | Add sample-based profiling, using a 1kHz timer Signed-off-by: Keith Packard <keithp@keithp.com>
* altos: Add custom panic noise for self-test failuresKeith Packard2012-08-31
| | | | | | Make it easier to tell which component is failing self test Signed-off-by: Keith Packard <keithp@keithp.com>
* altos: Clean up radio APIsKeith Packard2012-08-27
| | | | | | | Move api to ao_radio_cmac.h include file. Expose ao_radio_test as standard API. Signed-off-by: Keith Packard <keithp@keithp.com>
* altos: Place STM config values at fixed addresses for re-useKeith Packard2012-07-17
| | | | | | | | Just like cc1111, stick the serial number and radio calibration values at known fixed addresses so that when re-flashing the board, we can go find the existing values. Signed-off-by: Keith Packard <keithp@keithp.com>
* altos: Create macros to convert from/to radio RSSI representationKeith Packard2012-07-11
| | | | | | | | AO_RSSI_FROM_RADIO and AO_RADIO_FROM_RSSI. Removes a bunch of open-coded versions of the same function. Signed-off-by: Keith Packard <keithp@keithp.com>
* altos: Signal continuity over radio in pad mode (trac #40)Keith Packard2012-07-10
| | | | | | | This is especially useful for telemini which has no beeper, allowing you to hear the continuity signal while at the pad over the air. Signed-off-by: Keith Packard <keithp@keithp.com>
* altos: Make profiling Viterbi decoder more usefulKeith Packard2012-06-27
| | | | | | | This blocks starting the decoder until all of the data have arrived so that the time spent in the decoder is easily computed. Signed-off-by: Keith Packard <keithp@keithp.com>
* altos: Clean up radio CRC handlingKeith Packard2012-06-27
| | | | | | | Make the FEC code just set the CRC_OK bit like the cc1111 radio does; eliminates a bunch of weird conventions across the FEC API. Signed-off-by: Keith Packard <keithp@keithp.com>
* altos: include targe SPI speed in get requestKeith Packard2012-06-27
| | | | | | | STM needs it to be provided when enabling the SPI device, so just fix AVR and cc1111 to do the same. Signed-off-by: Keith Packard <keithp@keithp.com>
* altos: Clean up cc1120 driver a bitKeith Packard2012-06-27
| | | | | | Make some variables static, remove stale debug code Signed-off-by: Keith Packard <keithp@keithp.com>
* altos: Optimize FEC encode and decodeKeith Packard2012-06-26
| | | | | | | | | | | | | Integrate interleaving, CRC and padding within the decode/encode functions. Provide for ISR priorities so that the 1120 RX interrupt takes precedence over the other interrupts or we risk losing bits. Optimize the viterbi decoder a bit (goes from 10ms per packet to 7ms per packet). Signed-off-by: Keith Packard <keithp@keithp.com>
* altos: Incremental viterbi decodeKeith Packard2012-06-25
| | | | | | | | Decode radio input one interleave block at a time. This overlaps the decode computation with the packet reception, leading to lower latency in an attempt to keep up with the transmitter. Signed-off-by: Keith Packard <keithp@keithp.com>
* altos: decode cc1120 received packetsKeith Packard2012-06-25
| | | | | | Call the fec decode function, compute RSSI and check CRC Signed-off-by: Keith Packard <keithp@keithp.com>
* altos: Get cc1120 packet reception workingKeith Packard2012-06-25
| | | | | | Interrupt-per-bit, but it seems to work Signed-off-by: Keith Packard <keithp@keithp.com>
* altos: make cc1120 ao_radio_send re-entrantKeith Packard2012-06-17
| | | | | | It gets called from multiple tasks, so put local data on the stack. Signed-off-by: Keith Packard <keithp@keithp.com>
* altos: Software implemenation of CC1111 radio encodingKeith Packard2012-06-17
| | | | | | | Add CRC, whitening, FEC and interleaving routines for transmission path to allow cc1120 to send telem packets to cc1111. Signed-off-by: Keith Packard <keithp@keithp.com>