Commit graph

1199 commits

Author SHA1 Message Date
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
Niclas Finne 1fdb04e10c Added stub for extended radio API for cc2430 2014-04-03 13:38:21 +02:00
Niclas Finne cb3e053232 Added stub for extended radio API for rf230 2014-04-03 13:38:20 +02:00
Niclas Finne fa908dcaff Added extended radio API implementation for STM32W 2014-04-03 13:38:09 +02:00
Ian Martin 56d0dfdc7a CC2538: Add a Makefile rule to generate a final assembly listing. 2014-04-02 18:17:49 -04:00
Niclas Finne 767a9aeef1 Use platform configuration for CC2420/CC2520 SFD on MSP430 based platforms 2014-03-28 11:54:10 +01:00
Niclas Finne 279b7fd040 Added rule to autocompile mspsim if needed and show warning if submodule MSPSim has not been initialized 2014-03-28 11:11:51 +01:00
Oliver Schmidt a630fbd5da Removed unused variable. 2014-03-27 19:24:23 +01:00
Atis Elsts 68b65e6c47 Fix CPU clock calibration in msp430f2xxx based platforms (e.g. Zolertia Z1).
The following problems were present in the existing DCO calibration algorithm:

Problem #1. In function msp430_quick_synch_dco(), the "for(i=0; i < 1000; i++) { .. }" loop is optimized away by the compiler, as i is not volatile. Making i volatile would improve the results, but would not be sufficient: see the next point.

Problem #2. According to MSP430F2617 Device Erratasheet, bug BCL12 precludes a naive implementations of "fast" calibration altogether. The bug is present on all MCU revisions up to date.

The description of the bug:
"After switching RSELx bits (located in register BCSCTL1) from a value of >13 to a value of <12 OR from a value of <12 to a value of >13, the resulting clock delivered by the DCO can stop before the new clock frequency is applied. This dead time is approximately 20 us. In some instances, the DCO may completely stop, requiring a power cycle.

Furthermore, if all of the RSELx bits in the BSCTL1 register are set, modifying the DCOCTL register to change the DCOx or the MODx bits could also result in DCO dead time or DCO hang up."

In Contiki code for msp430f2xxx @ 8MHz, the RSEL search currently typically goes from 15 down to 11, thus violating the rules.

Step-by-step RSEL change is proposed as the best possible workaround:
"[..] more reliable method can be implemented by changing the RSEL bits step by step in order to guarantee safe function without any dead time of the DCO."

Problem #3. The old Contiki code started from the highest possible calibration values: RSEL=15, DCOx=7. According to MSP430F2617
datasheet, this means that the DCO frequency is set to 26 MHz. For one, Vcc under 3V is not supported for this frequency, so this means that battery-powered nodes have a big problem. The minimal operating voltages are:
- 1.8V for RSEL <= 13
- 2.2V for RSEL = 14
- 3.0V for RSEL = 15
So the correct way is to always start calibration from RSEL <= 13, unless explicityly pre-calibred values are present.

Problem #4. Timer B should be turned off after the calibration, following the "Principles for Low-Power Applications" in MSP430 user's Guide.

The patch fixes these issues by performing step-by-step calibration and turning off Timer B afterwards. As opposed to MSP430F1xxx calibration, this algorithm does not change the ACLK divider beforehand; attempts to make calibration more precise would lead to looping in some cases, as the calibration step granularity at larger frequencies is quite big.

Additionally, the patch improves DCOSYNCH_CONF_ENABLED behavior, allowing the resynchronization to correct for more than one step.
2014-03-25 11:47:13 +01:00
Ian Martin 336224633a Eliminate UART_CONF_IBRD and UART_CONF_FBRD. 2014-03-22 10:26:03 -04:00
Ian Martin ee45fc7533 Change uart_set_baudrate() to a do-while statement. 2014-03-22 10:22:11 -04:00
Ian Martin 1ceb8ae358 Fix rounding error in baudrate calculation. 2014-03-22 10:21:54 -04:00
Oliver Schmidt 370650baa3 Updated cc65 URL. 2014-03-15 16:55:39 +01:00
Ian Martin e3c19714d4 cc2538: Support any UART baudrate. 2014-03-14 16:06:24 -04:00
George Oikonomou 5675e688a8 Merge pull request #562 from Noolitic/CC2538_UART
CC2538: add support for UART baudrate 9600, 38400 and 57600
2014-03-08 23:41:52 +00:00
Brad Campbell d14f0d5eed CC2538: add secondary location to ieee address
The CC2538 currently has two addressing options: a hardcoded address set
at compile time or the address stored in primary address section of the
info page. This commit adds the option to choose the secondary location
of the ieee address from the info page, or any memory address.

To use, define `IEEE_ADDR_CONF_USE_SECONDARY_LOCATION` in `project-conf.h`
or similar.

For example:

    #define IEEE_ADDR_CONF_USE_SECONDARY_LOCATION 1
2014-03-06 10:31:30 -05:00
Oliver Schmidt b6c9950b94 Adjust shadow register to full 8kB RX buffer. 2014-02-27 20:23:41 +01:00
Oliver Schmidt 3e5e054f2a Adjusted base address to final product. 2014-02-26 20:23:09 +01:00
LudovicW d979e5b096 CC2538: add support for UART baudrate 9600, 38400 and 57600 2014-02-11 16:01:36 +01:00
Oliver Schmidt 9a44bafb16 Merge pull request #553 from oliverschmidt/master
Some fine tuning after the recent general modularization.
2014-02-02 11:14:17 -08:00
Oliver Schmidt ee3050897a Some fine tuning after the recent general modularization. 2014-02-02 17:59:06 +01:00
Oliver Schmidt 4db675e259 Some fine tuning after the recent general modularization. 2014-02-02 17:47:17 +01:00
Oliver Schmidt e16521e5c1 Merge pull request #550 from oliverschmidt/master
Avoid compiler warnings.
2014-01-31 16:22:53 -08:00
Oliver Schmidt a94e7e63e2 Avoid compiler warnings. 2014-02-01 00:46:57 +01:00
George Oikonomou 332d56ac11 Make some CC2538 CFLAGS and LDFLAGS common
Some CFLAGS and LDFLAGS previously only enabled with SMALL=1 have
now been enabled for all builds, regardless of the value of SMALL.

Therefore, from now on, SMALL only chooses between -Os and -O2
2014-01-31 20:02:43 +00:00
George Oikonomou a63376f8be Use -Os for CC2538 builds
As discussed in #503, -Os was broken with one of the toolchains
recommended in the platform's README and for that reason we were
using -O2 by default.

This commit sets the default to -Os and updates the README to no
longer recommend the toolchain in question
2014-01-31 20:02:43 +00:00
George Oikonomou c8fbf8ca6e Merge pull request #503 from ADVANSEE/cc2538-nrdata-noload
cc2538: Clean up link stage
2014-01-30 07:58:55 -08:00
Nicolas Tsiftes 4e6bed24f9 Merge pull request #547 from adamdunkels/push/rimeaddr-linkaddr
Rename the rimeaddr module to linkaddr
2014-01-29 12:57:44 -08:00
Adam Dunkels 45265249fc Changed the name of the rimeaddr module to linkaddr 2014-01-29 20:12:24 +01:00
George Oikonomou 345532c559 Merge pull request #546 from ADVANSEE/cc2538-fix-disabled-lpm
cc2538: lpm: Fix build for LPM_CONF_ENABLE == 0
2014-01-29 08:40:56 -08:00
Adam Dunkels 765e9acded Merge pull request #499 from adamdunkels/bold/modularize-everything
A bold move: modularize everything
2014-01-29 08:17:10 -08:00
Benoît Thébaudeau 42c287f363 cc2538: lpm: Fix build for LPM_CONF_ENABLE == 0
lpm.c needs to #include lpm.h in order to get the definition of
lpm_periph_permit_pm1_func_t, which made the replacement macros conflict with
the function definitions for the LPM_CONF_ENABLE == 0 case. This change fixes
this issue by #if-ing out the code in lpm.c in that case. Also, the replacement
macro for lpm_register_peripheral() was missing in that case, which is fixed
here.

Signed-off-by: Benoît Thébaudeau <benoit.thebaudeau@advansee.com>
2014-01-28 20:21:06 +01:00
Benoît Thébaudeau a562acb160 cc2538: Fix library linkage
If a project needs to use some libraries at link stage, then the corresponding
linker options (e.g. '-lm') have to be passed after any .o file depending on
these libraries. Hence, LDFLAGS cannot be used to add such options when invoking
$(LD) in Makefile.cc2538, or it should be moved to the correct location.
Instead, this change adds TARGET_LIBFILES to the correct location, like most
other Contiki targets.

Signed-off-by: Benoît Thébaudeau <benoit.thebaudeau@advansee.com>
2014-01-28 14:32:30 +01:00
Adam Dunkels 824d2047da Add the explicit list of modules, since we cannot do auto-dependency management of them 2014-01-26 23:20:47 +01:00
Adam Dunkels a40a73db9a Made a module out of the core/ctk code 2014-01-26 23:20:44 +01:00
Adam Dunkels dee654cfe5 Put the cc253x custom makerules in its own customrules file 2014-01-26 23:20:41 +01:00
Adam Dunkels 7846eb2e2f Split the cc2430 custom rules into its own file 2014-01-26 23:20:40 +01:00
Adam Dunkels 36a5aadc9e Moved the 6502 custom rules into its own Makefile.customrules-6502 file 2014-01-26 23:20:40 +01:00
Adam Dunkels 0fe08205e1 Moved the rimeaddr.[ch] code from the core/net/rime module to the core/net module, as it is used not only by rime code 2014-01-26 23:20:36 +01:00
Adam Dunkels c9efe3c3c4 Moved the cc2520 driver into its own dev/cc2520 module 2014-01-26 23:20:31 +01:00
Adam Dunkels 0b805e4763 Moved the cc2420 driver into a separate dev/cc2420 module 2014-01-26 23:20:27 +01:00
Adam Dunkels 5f3fe7f7c7 Updated include paths for the moved files under net/ 2014-01-26 23:20:23 +01:00
Ian Martin 935322665e rl78: Attempt to locate the IAR installation automatically and instruct the user how to specify IAR_PATH if it cannot be found. 2014-01-24 12:50:43 -05:00
Ian Martin ffa0147920 rl78: Rename CORE to RL78_CORE to avoid a conflict with Contiki's CORE variable. 2014-01-24 11:49:47 -05:00
Oliver Schmidt 8baf2d7b42 Merge pull request #536 from oliverschmidt/master
Copied 'contiki_arg[c|v]' from 'native' to the other desktop targets.
2014-01-24 03:41:42 -08:00
Oliver Schmidt fc983e2e79 Copied 'contiki_arg[c|v]' from 'native' to the other desktop targets.
- On the retro targets support for 'contiki_arg[c|v]' is optional as accesing arg[c|v] is rather expensive.
2014-01-24 11:56:40 +01:00
Ian Martin 1b61f1bb7b Add cpu/rl78/dev/uart1.h because some examples rely on it. 2014-01-22 18:42:24 -05:00
Ian Martin a897426410 Increase the default baudrate to 38400 bps for RL78. 2014-01-22 18:42:18 -05:00
Ian Martin 00468a3f53 Fix buggy UART baudrate calculation in the RL78 UART driver. 2014-01-22 18:41:55 -05:00
Oliver Schmidt 510678bed0 Added mouse support for the Atari. 2014-01-20 22:51:40 +01:00
Oliver Schmidt a24865de72 Add somewhat more support to use different mouse drivers.
- The default mouse driver is now always named 'contiki.mou'.
- Alternative mouse drivers are present in the disk images.
- Users can select their mouse driver by renaming the files.
2014-01-17 23:45:59 +01:00
Oliver Schmidt fb20cf5ee6 Added UIP_CONF_LLH_LEN. 2014-01-17 22:07:03 +01:00
Ian Martin 7d3053bbc5 Remove hyphen from preprocessor symbol to fix compiler warning. 2014-01-10 16:31:05 -05:00
Benoît Thébaudeau 7f48057b9e leds: Fix the API
The leds API did not work in some cases. E.g. with the following sequence:
  leds_off(LEDS_ALL);
  leds_toggle(LEDS_GREEN);
  leds_off(LEDS_ALL);
the green LED was remaining on after the last call.

This was caused by the toggle feature made synonymous with the invert feature,
although it is unrelated. leds_toggle() is indeed supposed to toggle an LED,
while leds_invert() is supposed to change the active level of an LED. However,
all users of leds_invert() actually meant leds_toggle(), and the invert feature
does not make sense in this module because it is not handy due to successive
calls to leds_invert() changing the intended behavior, and hardware active
levels should be managed in leds_arch_set() (e.g. by XORing the passed value
with a hardware-specific constant before setting the output levels of the pins).

Consequently, this change:
 - removes the leds_invert() function,
 - makes leds_toggle() behave as expected relatively to leds_off() / leds_on(),
 - sanitizes the code in the leds module.

Signed-off-by: Benoît Thébaudeau <benoit.thebaudeau@advansee.com>
2014-01-07 13:02:41 +01:00