Commit Graph

1152 Commits

Author SHA1 Message Date
Atis Elsts
705587cdb7 Fix time accounting on msp430 Series 1 and Series 2 MCU based platforms.
The problem with the current version of the code was that the condition at the end of the do...while loop at Timer A1 interrupt:
 while((TACCR1 - TAR) > INTERVAL);
evaluates to false whenever TACCR1 == TAR.
Not incrementing TACCR1 in this case leads to Timer A1 interrupt not being called for 2 seconds, until TAR counter reaches TACCR1 again after an overflow.

The patch avoids this problem by changing the condition of the loop, and using CLOCK_LT macro to compare between time values.

The patch also attempts to fix another problem: a read of TAR register while it is being updated may return a lower value than the actual contents. To avoid that, the "read twice and compare results" idiom should be used. As the TAR register is updated by the actual hardware, it is of no importance whether it is read with interrupts disabled or enabled; the problem can occur in both contexts.
2014-07-02 11:07:02 +02:00
Antonio Lignan
3d64b80e40 Added flags to enable 20-bit support from msp430-gcc 4.7.x 2014-06-17 12:55:08 +02:00
Oliver Schmidt
d955b179eb Merge remote-tracking branch 'upstream/master' 2014-06-12 22:57:46 +02:00
Oliver Schmidt
a5d7a06027 Enhanced Ethernet drivers.
Made Ethernet drivers easier to consume by assembly programs.
* Replaced function pointers with JMP instructions.
* Provide return values additionally via Carry flag.

Reset Ethernet chips on initialization.
Both for the CS8900A and the W5100 the data sheets just say that
the RESET bit is automatically cleared after the RESET. This may
be interpreted in two ways:
1) There's no need to be afraid of reading the RESET bit as 1 and
unintentionally trigger a RESET by writing it back after ORing in
some other bit.
2) The RESET process isn't complete before the RESET bit hasn't
become 0 again.
It's impossible for me to empirically falsify the latter option
as the drivers are supposed to work on faster machines than the
ones I have access to. And if the RESET process includes things
like oscillators then the time to complete the RESET could differ
even between multiple exemplars of the same chip. Therefore I
opted to presume the latter option.
However that means a non-exsistent chip may cause an infinite
loop while waiting for the RESET bit to be cleared so I finally
added code to detect the presence of the Ethernet chips. There's
a risk of a chip being locked up in a way that makes the detection
fail - and therefore the RESET not being performed. This catch-22
needs to be solved by the user doing a hard RESET.
2014-06-12 22:56:35 +02:00
Adam Dunkels
9ceb059c21 Merge pull request #611 from nfi/cc2x20-sfd-config
Corrected CC2x20 sfd config and startup message.
2014-06-11 23:17:05 +02:00
Adam Dunkels
def57199b9 Merge pull request #511 from ADVANSEE/leds
leds: Fixes and enhancements
2014-06-11 22:37:34 +02:00
George Oikonomou
3552376324 Merge pull request #702 from g-oikonomou/ieee-addr-fixes
Fix incorrect IEEE address byte re-ordering
2014-06-11 09:54:52 +01:00
Oliver Schmidt
a0961fc3c4 Build static Ethernet drivers directly from source. 2014-06-09 23:35:19 +02:00
Oliver Schmidt
f124425ee1 Build static Ethernet drivers directly from source. 2014-06-09 23:14:11 +02:00
George Oikonomou
9d7c3b9866 Improve documentation for the CC2538 IEEE address re-ordering 2014-06-06 18:33:28 +01:00
George Oikonomou
5acc20fc47 Improve code style 2014-06-06 18:32:58 +01:00
George Oikonomou
623d6084e7 Make the CC2538 secondary IEEE address location configurable 2014-06-06 18:15:07 +01:00
LudovicW
66edb5b263 Fix incorrect IEEE address byte re-ordering 2014-06-06 17:22:33 +01:00
George Oikonomou
2e166a83c7 Merge pull request #691 from hexluthor/rts-cts
CC2538: Add hardware flow control (RTS/CTS) support on UART1.
2014-06-04 09:22:58 +01:00
George Oikonomou
ba9c2d40eb Merge pull request #682 from g-oikonomou/watchdog-cc2538
Confine CC2538 WDT on/off conf inside the driver
2014-06-03 22:05:08 +01:00
Adam Dunkels
64f65b4e45 Merge pull request #617 from nfi/extended-radio-api
Extended radio API with support for setting channel, pan id, addressing modes, etc
2014-06-03 21:32:53 +02:00
Ian Martin
274b3dcd0b CC2538: Add hardware flow control (RTS/CTS) support on UART1. 2014-06-03 12:38:24 -04:00
Rémy Léone
25c8b0835d Closing doxygen groups 2014-05-30 11:01:20 +02:00
George Oikonomou
807ee624e4 Confine CC2538 WDT on/off conf inside the driver
Instead of requiring all calls to `watchdog_start` to be
wrapped inside `#if WATCHDOG_CONF_ENABLE` guards, we control
things from within the WDT driver itself.

This commit also includes some minor documentation and
indentation cleanups
2014-05-18 14:12:16 +02:00
George Oikonomou
b864ec2b71 Merge pull request #661 from hexluthor/watchdog-enable
CC2538: Add WATCHDOG_CONF_ENABLE to optionally disable the watchdog timer
2014-05-18 14:11:49 +02:00
George Oikonomou
026864d129 Merge pull request #665 from hexluthor/cc2538-flash-conf
CC2538: Add FLASH_CONF_ORIGIN and FLASH_CONF_SIZE config parameters.
2014-05-18 13:12:49 +02:00
Nicolas Tsiftes
73086e34f7 Merge pull request #632 from nfi/verbosity-control-stm32w
Add support for verbosity control for building STM32W-based platforms
2014-05-07 16:12:12 +02:00
Ian Martin
2abaeaa8cc CC2538: Add FLASH_CONF_ORIGIN and FLASH_CONF_SIZE config parameters. 2014-05-02 11:35:58 -04:00
Ian Martin
7081440eff CC2538: Add WATCHDOG_CONF_ENABLE to optionally disable the watchdog timer. 2014-05-02 10:28:30 -04:00
Oliver Schmidt
5829bc5159 Adjustment to cc65 change. 2014-05-01 21:32:32 +02:00
George Oikonomou
08c884afa0 Improve the CC2538 extended RF API implementation
* Decouple 64-bit address from LINKADDR_SIZE
* get and set object from/to the start/end of the src/dest buffer
* We expect size == 8 (rather than size < 8) for both get_ and set_object. Error otherwise
* The RF no longer sets parameters by itself. We let the platform do this, using the extended API.
2014-04-23 12:20:16 +01:00
George Oikonomou
6028c0765f Don't hardcode min and max TX power values 2014-04-23 12:16:50 +01:00
George Oikonomou
3183805ba4 Implement extended RF API for the CC2530 RF 2014-04-23 12:16:50 +01:00
George Oikonomou
b0f1199202 Merge pull request #636 from g-oikonomou/fix-random-init-lockup
Fix CC2538 random_init lockup
2014-04-18 13:28:40 +01:00
George Oikonomou
49bf7cc241 Merge pull request #616 from hexluthor/listing
CC2538: Add a Makefile rule to generate a final assembly listing.
2014-04-17 22:13:52 +01:00
Benoît Thébaudeau
d93d129da6 cc2538: uart: Make it possible to use several UARTs simultaneously
This avoids the limitation of having a single UART available at runtime, without
duplicating code.

Signed-off-by: Benoît Thébaudeau <benoit.thebaudeau@advansee.com>
2014-04-17 18:53:44 +02:00
Brad Campbell
af27d2d252 [CC2538-SPI] Implement SPI_FLUSH, spi mode, !CS
Because the CC2538 has a multi-byte SPI RX FIFO, flushing the buffer
requires more than just a single read. This adds a loop that empties the
entire RX buffer on a FLUSH().

Different SPI chips needs different SPI settings. This commit adds a
function that allows chip drivers to configure the SPI peripheral before
using it.

The frame pin the driver was using as a chip select does not work as
most devices expect it to. It toggles after every byte, and most chips
interpret that as end of message. To make drivers more reliable, each
chip driver should setup a GPIO and assert it as needed.
2014-04-15 14:07:10 -04:00
Nicolas Tsiftes
19cd33664d Merge pull request #633 from nfi/verbosity-control-msp430
Add support for verbosity control for building MSP430-based platforms with the IAR compiler.
2014-04-14 16:38:07 +02:00
George Oikonomou
0ec1eda75e Implement extended RF API for the CC2538 2014-04-14 15:25:30 +02:00
Niclas Finne
f0c48c55ca Fixed STM32W radio to return RADIO_RESULT_INVALID_VALUE if trying to
set a transmission power outside the valid range instead of using
closest valid value.
2014-04-13 21:36:45 +02:00
George Oikonomou
602f834caf Merge pull request #472 from ADVANSEE/cc2538-clock-adjust-etimer-poll
cc2538: clock: Fix clock / timer issues with PM1/2
2014-04-13 16:35:17 +01:00
George Oikonomou
eed1352282 Fix CC2538 random_init lockup
Contiki sometimes fails to boot correctly and locks up in
random_init()

This problem only manifests itself for specific versions
of the arm-gcc toolchain and then again only for specific
levels of optimisation (-Os vs -O2, depending on the
value of the SMALL make variable)

The lockup is caused when we write an RFCORE XREG before
the RF clock ungating has taken effect, which in turn
only occurs depending on the assembly generated for those
two instructions:

  REG(SYS_CTRL_RCGCRFC) = 1;

  REG(RFCORE_XREG_FRMCTRL0) = 0x00000008;

This commit makes the RNG wait for the ungating to take
effect before attempting to write the register
2014-04-13 14:38:00 +01:00
George Oikonomou
33abe26ec8 Merge pull request #411 from ADVANSEE/cc2538-adc
cc2538: Add adc driver and example
2014-04-13 03:05:12 +01:00
George Oikonomou
22554e6d72 Merge pull request #596 from hexluthor/cc2538-uart-baudrate
cc2538: Support any UART baudrate.
2014-04-13 02:51:58 +01:00
Niclas Finne
757950f87f Set the RAM and flash size based on the CPU configuration for STM32W 2014-04-11 17:41:09 +02:00
Niclas Finne
0122373fdc OBJECTDIR is defined by Makefile.include 2014-04-11 17:41:08 +02:00
Niclas Finne
4e7abb09c2 Support verbosity control when building for STM32W-based platforms 2014-04-11 17:41:06 +02:00
Niclas Finne
2c953c3346 Support verbosity control when building MSP430-based platforms with
the IAR compiler.
2014-04-11 17:36:42 +02:00
Niclas Finne
207f1987ee Implemented radio rx mode parameter for STM32W, changed the byte order
of the 64 bit address to big-endian.
2014-04-11 14:46:48 +02:00
Nicolas Tsiftes
1b49b68c3b Merge pull request #606 from atiselsts/master
Fix MCU clock calibration in msp430f2xxx based platforms (e.g. Zolertia Z1)
2014-04-09 21:52:08 +02:00
Niclas Finne
4834816306 Added radio parameter RADIO_PARAM_CCA_THRESHOLD for STM32W 2014-04-08 16:42:18 +02:00
Niclas Finne
441beb8f74 Added stub for extended radio API for rl78 2014-04-03 13:38:28 +02:00
Niclas Finne
2dc4d06078 Added stub for extended radio API for mc1322x 2014-04-03 13:38:26 +02:00
Niclas Finne
14ffa35b3f Added stub for extended radio API for cc253x 2014-04-03 13:38:25 +02:00
Niclas Finne
a98e153e23 Added stub for extended radio API for cc2538 2014-04-03 13:38:23 +02:00