Commit graph

99 commits

Author SHA1 Message Date
George Oikonomou cd5a0ef291 Consolidate .upload for all CC26xx/CC13xx boards
The block that controls the `.upload` target is unnecessarily replicated in multiple sub-board Makefiles. This was originally done because the SmartRF and the Launchpad can be programmed with the c2538-bsl script, whereas the sensortag cannot.

This commit moves the `cc2538-bsl` / `.upload` target logic to the top level cpu Makefile (`cpu/cc26xx-cc13xx/Makefile.cc26xx-cc13xx`). Board makefiles simply set the make variable `BOARD_SUPPORTS_BSL` to 1 to signal that they can be programmed by the BSL script. If `BOARD_SUPPORTS_BSL` is not equal to 1, trying to use the `.upload` target will return an error message.

For example:

```
$ make BOARD=sensortag/cc2650 cc26xx-demo.upload
using saved target 'srf06-cc26xx'
This board cannot be programmed with the ROM bootloader and therefore does not support the .upload target.
```
2016-05-14 19:30:53 +01:00
George Oikonomou 00d5645d16 Merge pull request #1601 from philrhinehart/bugfix-cc26xx-ble-events
cc26xx-cc13xx BLE beacon event issue
2016-04-18 20:06:33 +01:00
Phil Rhinehart 5d5544151f Fixed bug in cc26xx-cc13xx rf-core. When running BLE in conjunction with ContikiMAC, oscillators were modified from an interrupt state causing occasional bus faults and infinite loops. We now check if BLE is active prior to modifiying the oscillators to avoid these conditions. 2016-04-18 17:17:07 +08:00
Phil Rhinehart 2a07dc0e0a This fixes an event handling issue in the cc26xx BLE driver. Currently, the rf_ble_beacon_process triggers the BLE beacon upon receiving any event, rather than verifying that the event timer has expired. This means that any PROCESS_BROADCAST (e.g. any sensor event) will fire the beacon. This commit adds logic to prevent this. 2016-04-18 17:14:37 +08:00
harald42 98e4451518 Merge branch 'contiki' into osd 2016-02-25 08:18:55 +01:00
harald42 e7f270cf37 crf replace by lf 2016-02-25 08:11:05 +01:00
Billy Kozak 786aa19cbd Fixed numeruous bus in CC26xx-CC13xx lpm
Bug fixes include:
- keep interrupts disabled during lpm_sleep() so that we don't
  miss any interrupts we may have been expecting
- check that the pending etimer isn't already expired (and don't sleep
  at all if it is)
- check that the about-to-be scheduled rtimer wakeup is neither too
  far into  the future nor too close into the future (or even in the
  past) before actually setting the interrupt (should fix #1509); If
  the time is out of bounds we use a default min or max value instead.
- Correctly handle LPM_MODE_MAX_SUPPORTED set to zero (and added a
  macro for the zero value) so that sleeping can be disabled altogether
- If no etimer is set, we specify a wakeup time which is reasonably far
  into the future instead of setting none at all (this will save on
  power consumption whenever no etimers are set).

Also did a bit of refactoring in that some long functions were broken
into multiple functions.
2016-02-23 10:41:01 -07:00
George Oikonomou d42b1b50e5 Allow the caller to access the entire content of CMDSTA
When sending a command to the CC13xx/CC25xx RF core, we wait for command completion by checking the LSB of CMDSTA (correctly so). However, in doing so we also zero out the 3 CMDSTA return bytes. For some commands, those bytes contain useful information (e.g. an RSSI value) and are required by the caller.

This problem manifests itself e.g. in PROP mode `channel_clear()`, whereby the caller will always see an RSSI value of 0.

This pull therefore fixes the logic in `rf_core_send_cmd()` to check for command completion by blocking on the CMDSTA result byte without zeroing out the 3 return bytes.

Fixes #1465
2016-01-24 13:39:14 +00:00
George Oikonomou ab59a387b3 Merge pull request #1371 from g-oikonomou/bugfix/cc26xx/lpm-operation
Improve the stability of CC13xx/CC26xx low-power operation
2016-01-09 18:07:47 +00:00
George Oikonomou b97a3d1049 Merge pull request #1242 from g-oikonomou/contrib/cc26xx-ieee-volatile-cmd-ieee-tx
Use volatile access for CMD_IEEE_TX
2016-01-09 18:01:40 +00:00
George Oikonomou 3a831cbebf Merge pull request #1322 from g-oikonomou/bugfix/cc26xx/interrupt-flag-management
Clear CC26xx/CC13xx interrupt flags selectively
2016-01-09 18:01:15 +00:00
George Oikonomou 109696174f Merge pull request #1350 from g-oikonomou/bugfix/cc26xx/tx-power
Correctly set new CC26xx TX power when the RFC is powered off
2016-01-09 17:59:24 +00:00
George Oikonomou fa002c2d73 Merge pull request #1321 from g-oikonomou/bugfix/cc26xx/remove-redundant-reads
Remove redundant function calls in CC13xx/CC26xx RFC code
2016-01-09 17:52:15 +00:00
Benoît Thébaudeau 6166693a11 Merge pull request #1133 from bkozak-scanimetrics/cc-gcc
put gcc specific stuff into seperate .h
2015-12-05 00:39:59 +01:00
George Oikonomou 571cf9364a Improve CC13xx/CC26xx LPM logic
This commit applies a number of improvements to the logic used when trying to drop to a CC13xx/CC26xx low-power mode:

* We identify whether there are any pending etimers by using `etimer_pending()` instead of `etimer_next_expiration_time()`. This subsequently allows us to also identify whether an etimer is set to fire at time 0.
* We run a larger portion of the code with the global interrupt disabled. This prevents a number of messy conditions that can occur if an interrupt fires after we have started the low-power sequence.
* We check whether there are pending events earlier in the sequence.
* We make sure to schedule a next wakeup event even when an LPM module prohibits deep sleep and forces sleep instead.

This fixes some of the issues discussed in #1236
2015-11-14 02:48:46 +01:00
George Oikonomou 08fddb6598 Always set a valid time for the next AON RTC CH1 compare event
The AON RTC CH1 event handler aims to schedule the next compare event on the next 512 RTC counter boundary. However, the current calculation of "now" takes place too early within the interrupt handler. In some cases, this results in the next event getting scheduled too soon in the future or on some extreme cases even in the past.

AON RTC compare events cannot happen within 2 SCLK_LF cycles after a clearance (4 RTC ticks in the 16.16 format). Thus, if the next 512 boundary is too soon (5 ticks for margin), we skip it altogether. When this happens, etimers that would have expired on the skipped tick will expire 1 tick later instead. Skipping a tick has no negative impact on our s/w clock counter, since this is always derived directly from the hardware counter.
2015-11-14 02:44:04 +01:00
George Oikonomou b4393e861f Only set CC13xx prop mode channel if a new channel is being requested 2015-11-14 01:38:24 +01:00
George Oikonomou 320a753666 Turn CC13xx RF back off after prop TX if it was off to start with 2015-11-14 01:38:24 +01:00
George Oikonomou e0e20aa3fd Turn off ENERGEST_TYPE_LISTEN in CC13xx prop mode off() 2015-11-14 01:38:24 +01:00
Simon Duquennoy fbd78a7e3b Merge pull request #1293 from simonduq/pr/fix-warnings
Fix a number of compiler warnings and enable -Werror in Travis
2015-11-10 08:49:11 +01:00
George Oikonomou a63efe947f Merge pull request #1233 from adamdunkels/pr/26xx-13xx-fixes
CC26xx/CC13xx fixes
2015-11-09 08:33:58 +00:00
George Oikonomou 3aa4547327 Merge pull request #1257 from bkozak-scanimetrics/cc26xx_fully_turnoff_radio
CC26xx - fully shutdown the rf-core & abort rx op
2015-11-04 15:45:05 +00:00
George Oikonomou 54648591ee Explicitly send CMD_ABORT in prop mode before powering down 2015-11-01 22:53:35 +00:00
George Oikonomou f401c7cc60 Save new TX power setting even if the RFC is powered off.
The current logic attempts to send `CMD_SET_TX_POWER` before saving the new power setting. If `CMD_SET_TX_POWER` fails the power setting will not get saved. As a result, when the RFC is powered off, all attempts to change TX power will fail.

This commit changes this logic to always save the new TX setting as requested by the user. If the RFC is powered up, we apply it immediately. If it is powered down, the new setting will automatically be applied next time we send `CMD_RADIO_SETUP`.

Fixes #1340
2015-11-01 20:56:52 +00:00
George Oikonomou 1ee40ef021 Fix the logic that detects whether a command is a Radio OP 2015-11-01 20:48:28 +00:00
George Oikonomou 946b72a58d Mask CMDSTA when waiting for a command to get accepted 2015-11-01 20:46:46 +00:00
George Oikonomou 3e0f37090c Merge pull request #1324 from msloth/master
Remove LED fade in lpm.c
2015-10-29 11:36:39 +00:00
Marcus Linderoth 1906bff17c allow lpm_shutdown without a wake-up pin set 2015-10-28 11:06:26 +01:00
Marcus Linderoth ea7a5d1c63 Remove fade away of LED when going into shutdown mode; it consumes power and is application-layer stuff. 2015-10-28 10:51:37 +01:00
George Oikonomou 55b41863d5 Remove redundant function calls in CC26xx RFC code
As discussed in #1279, the current CC13xx/CC26xx rf-core code makes some unnecessary power domain-related reads. This commit removes them.

Closes #1279
2015-10-24 20:54:33 +01:00
George Oikonomou 8636a28248 Clear interrupt flags selectively
As discussed in #1294, every time a CC13xx/CC26xx RF interrupt fires, we clear all interrupt flags unconditionally. This may result in missed events. This patch fixes this bug by clearing only the flag that triggered the interrupt in the first place.

Fixes #1294
2015-10-24 20:51:34 +01:00
George Oikonomou 2773a37857 Update CCxxwares to our warning-free version 2015-10-20 10:11:41 +02:00
Adam Dunkels 12a185f394 Added the WERROR=1 flag to the CC2538 and CC26xx CPUs 2015-10-20 10:11:23 +02:00
Billy Kozak 8e5f0bc36a Defining gcc specific macros in seperate header 2015-09-22 14:17:10 -06:00
Billy Kozak 324d03b53c CC26xx - fully shutdown the rf-core & abort rx op
Prior to this patch, the ieee radio driver did not explicitly abort
the rx operation or power down the analog components of the radio
prior to shutting down the rf-core.

The result of this was that the rf-core continued to use a lot of
power even while "off".

This patch fixes this problem.
2015-09-14 13:18:01 -06:00
Nicolas Tsiftes 8a7e2e5892 Merge pull request #1240 from atiselsts/energest_accuracy
Improve energest accuracy
2015-09-07 15:35:35 +02:00
George Oikonomou 4ce6d215e8 Use volatile access for CMD_IEEE_TX 2015-09-04 17:59:25 +01:00
George Oikonomou dd640cd229 Merge pull request #1195 from bkozak-scanimetrics/cc26xx_improve_watchdog
CC26xx - various fixes and improvements for the watchdog module
2015-09-04 17:20:50 +01:00
Atis Elsts 2f79810b58 Use ENERGEST_SWITCH to switch between different power modes to improve energest accuracy. 2015-09-04 11:46:00 +02:00
Billy Kozak b71353181d CC26xx - enable correct IRQ in rf_core_cmd_done_en
Fix for #1229

rf_core_cmd_done_en() was enabling the wrong irq for detecting the
completion of foreground operations. This was causing cc26xx devices
to not wake-up on time when calling lpm_sleep() from transmit().
2015-09-02 12:37:33 -06:00
Adam Dunkels 8d2dafbe30 No need to set the same channel again 2015-09-02 12:18:27 +02:00
Adam Dunkels 27e373492d Turn off energest listen in off() 2015-09-02 12:10:44 +02:00
Adam Dunkels f1c4a5ee08 Turn off radio again after transmitting 2015-09-02 12:10:07 +02:00
Adam Dunkels 8bcde2e40f Tickless bugfixes:
* The clock interrupt must be scheduled relative to the last interrupt, not relative to the current time (which may have progressed significantly)
* clock_time() must increase continuously, so that code that may be spinning around clock_time() will make progress, not only after each interrupt
2015-09-02 12:05:47 +02:00
Billy Kozak fde3202a3f cc26xx - added optional locking mode for WDT
Added a mode, configurable by the CONTIKI_WATCHDOG_CONF_LOCK_BETWEEN_USE
macro, which locks the WDT register between uses so as to prevent
any accidental modifications
2015-08-31 09:12:16 -06:00
Billy Kozak 22d8a8dd56 cc26xx - implemented watchdog_stop
Also modified watchdog_start so that if we stop and start again the
watchdog timeout will be reset (by calling watchdog_periodic).
2015-08-31 09:12:16 -06:00
Billy Kozak dfdb0a6487 cc26xx - fixed WDT reloading
According to the TRM, the WDT does not produce a reset until it
expires twice. After expiring the WDT will set the INT flag if it
is unset, and reset the MCU if INT is already set.

Before this patch, watchdog_periodic() only un-sets the INT flag. This
means that the behaviour of watchdog_periodic is underministic in that
the value of the countdown timer will be different depending on
when the function was called.

This patch fixes this behaviour by also reloading the timout value.
2015-08-31 09:10:26 -06:00
Billy Kozak 85555cf6cf Made cc26xx WDT reload configurable with macro
CONTIKI_WATCHDOG_TIMER_TOP sets the reload value of the WDT
2015-08-31 09:10:26 -06:00
Jonas Olsson 01e36532c2 Add support for the CC13xx CPU
This commit:

* Moves all cpu files from cpu/cc26xx to cpu/cc26xx-cc13xx
* Bumps the CC26xxware submodule to the latest TI release
* Adds CC13xxware as a submodule
* Adds support for sub-ghz mode / IEEE 802.15.4g
* Splits the driver into multiple files for clarity. We now have the following structure:
  * A common module that handles access to the RF core, interrupts etc
  * A module that takes care of BLE functionality
  * A netstack radio driver for IEEE mode (2.4GHz)
  * A netstack radio driver for PROP mode (sub-ghz - multiple bands)

This commit also adds tick suppression functionality, applicable to all chips of the CC26xx and CC13xx families. Instead waking up on every clock tick simply to increment our software counter, we now only wake up just in time to service the next scheduled etimer. ContikiMAC-triggered wakeups are unaffected.

Laslty, this commit also applies a number of minor changes:
* Addition of missing includes
* Removal of stub functions
* Removal of a woraround for a CC26xxware bug that has now been fixed
2015-08-23 19:54:42 +01:00