Commit graph

177 commits

Author SHA1 Message Date
Benoît Thébaudeau 1f1b940cb9 cc2538: Add driver for the rom utility function library
Signed-off-by: Benoît Thébaudeau <benoit.thebaudeau@advansee.com>
2013-11-18 12:38:06 +01:00
Benoît Thébaudeau 035a30602b cc2538: lpm: Make periph_permit_pm1_funcs static
periph_permit_pm1_funcs[] is a private member of lpm.c, so define it as static.

Signed-off-by: Benoît Thébaudeau <benoit.thebaudeau@advansee.com>
2013-11-18 11:57:59 +01:00
George Oikonomou b10c78f854 Merge pull request #425 from ADVANSEE/cc2538-gpio
cc2538: gpio: Bug fix and various improvements
2013-11-15 13:04:09 -08:00
George Oikonomou 98a1f2dfa9 Merge pull request #408 from ADVANSEE/cc2538-uart
cc2538: lpm: Add registration mechanism for peripherals and use it
2013-11-15 12:57:03 -08:00
Benoît Thébaudeau 680050861c cc2538: gpio: Use accessor macros
Use the GPIO accessor macros instead of copying raw register access code all
over the place. This is cleaner and less error prone.

This fixes the setting of the USB pull-up resistor that worked only by chance on
the CC2538DK because it is controlled by the pin 0 of the used GPIO port.

Signed-off-by: Benoît Thébaudeau <benoit.thebaudeau@advansee.com>
2013-11-15 19:57:44 +01:00
Benoît Thébaudeau 923f161b7b cc2538: gpio: Add pin read / write and interrupt clear macros
Introduce new useful GPIO macros to:
 - read the levels of some port pins,
 - write the levels of some port pins (pass bit-field value to be set),
 - clear the interrupt flags for some port pins.

These macros are cleaner and less error prone than raw register access code
copied all over the place.

Signed-off-by: Benoît Thébaudeau <benoit.thebaudeau@advansee.com>
2013-11-15 19:48:24 +01:00
Benoît Thébaudeau 300d2d79ae cc2538: gpio: Fix usage of parameters in macros
The parameters in the GPIO macros were used without being parenthesized. This
could generate wrong values for register assignments in the case of expressions
passed as arguments to these macros.

Signed-off-by: Benoît Thébaudeau <benoit.thebaudeau@advansee.com>
2013-11-15 19:43:06 +01:00
Benoît Thébaudeau b8b54a033c cc2538: uart: Fix crippled output occurring upon lpm_enter()
lpm_enter() must not enter PM1+ if the UART TX FIFO is not empty. Otherwise, the
UART clock gets disabled, and its TX is broken.

Signed-off-by: Benoît Thébaudeau <benoit.thebaudeau@advansee.com>
2013-11-15 17:24:26 +01:00
Benoît Thébaudeau 0692ee251d cc2538: usb: Use the new LPM peripheral registration
Signed-off-by: Benoît Thébaudeau <benoit.thebaudeau@advansee.com>
2013-11-15 17:14:45 +01:00
Benoît Thébaudeau d35732505b cc2538: lpm: Add registration mechanism for peripherals
Some peripherals have their clocks automatically gated in PM1+ modes, so they
cannot operate. This new mechanism gives peripherals a way to prohibit PM1+
modes so that they can properly complete their current operations before
entering PM1+.

This mechanism is implemented with peripheral functions registered to the LPM
module. These functions return whether the associated peripheral permits or not
PM1+ modes. They are called by the LPM module each time PM1+ might be possible.
If any of the peripherals wants to block PM1+, then the system is only dropped
to PM0.

Partly from: George Oikonomou
Signed-off-by: Benoît Thébaudeau <benoit.thebaudeau@advansee.com>
2013-11-15 17:09:22 +01:00
George Oikonomou d08a87880c Merge pull request #410 from ADVANSEE/cc2538-sys_ctrl
cc2538: sys_ctrl: Make it possible to use the 32-kHz crystal
2013-11-15 07:42:45 -08:00
Benoît Thébaudeau f1ca1b742c cc2538: spi: Include spi-arch.h before dev/spi.h
spi-arch.h configures dev/spi.h, so it must be #included first. Luckily, this
mistake did not have any consequence here, but fix it in order to avoid possible
future issues.

Signed-off-by: Benoît Thébaudeau <benoit.thebaudeau@advansee.com>
2013-11-15 15:56:40 +01:00
Benoît Thébaudeau f34731c1a9 cc2538: spi: Do not call SPI_WAITFOREORx() at end of init
If the SSI has never been used and spi_init() is called, then the SSI receive
FIFO is empty and remains so, so calling SPI_WAITFOREORx() at the end of
spi_init() waits endlessly for SSI_SR.RNE to be set. Hence, this call must be
removed in order to avoid a deadlock.

Signed-off-by: Benoît Thébaudeau <benoit.thebaudeau@advansee.com>
2013-11-15 15:56:40 +01:00
Benoît Thébaudeau 47d570343e cc2538: sys_ctrl: Make it possible to use the 32-kHz crystal
Signed-off-by: Benoît Thébaudeau <benoit.thebaudeau@advansee.com>
2013-11-15 15:52:10 +01:00
Benoît Thébaudeau a7d10ce2ad cc2538: Make it possible to use a custom linker script
Signed-off-by: Benoît Thébaudeau <benoit.thebaudeau@advansee.com>
2013-11-15 15:41:58 +01:00
Benoît Thébaudeau 974850cdf2 cc2538: Generate .hex output
ELF files generated by GCC make SmartRF Flash Programmer 2 crash (only the TI
format is supported by this tool for ELFs), and binary files are not very
appropriate because they are gapless, so generate Intel HEX files since these
are very well supported by most programming tools while still flexible.

Signed-off-by: Benoît Thébaudeau <benoit.thebaudeau@advansee.com>
2013-11-15 15:41:58 +01:00
George Oikonomou e4a454b284 Set peripheral mode for the correct UART TX/RX pins 2013-09-30 14:50:39 +01:00
George Oikonomou 2957d44ff8 Merge pull request #352 from lab11/cc2538-spi-driver
Added SPI driver for CC2538
2013-09-28 13:25:17 -07:00
Brad Campbell e2af903d05 Added SPI driver for CC2538
This uses the core/dev/spi.h header and implements the spi_init()
function and the various macros for SPI operation. ssi.h contains all of
the register locations and information.

This implementation is not very versatile, mostly because I don't how to
make it flexible in the contiki system. It supports pin muxing for the
four spi pins, but other than that picks sensible defaults.

The SPI macros (like SPI_READ()) are defined in
cpu/cc2538/spi-arch.h. In order to use the SPI driver, add the following
includes to your project:

    #include "spi-arch.h
    #include "dev/spi.h"
2013-09-27 17:46:15 -04:00
Brad Campbell 982ca0fb46 Updates CC2538 GPIO
1. Fixes two of the comments to GPIO macros. They were copied but not
updated.
2. Adds SET and CLR macros for controlling GPIO pins.
2013-09-11 21:39:56 -04:00
George Oikonomou 6c6013b898 Make the CC2538 UART driver more configurable
* We can now very easily switch between UART0 and UART1 through a define
* We can also configure the UART RX and TX port/pin through defines
2013-08-09 12:20:25 +01:00
George Oikonomou c3b5d4f5e3 Add support for verbosity control 2013-08-07 15:26:22 +01:00
Peter A. Bigot 5fc0575e99 Makefile.include: support make clean all
Historically $(OBJECTDIR) was created when Makefile.include is read.  A
consequence is that combining "clean" with "all" (or any other build
target) results in an error because the clean removes the object
directory that is required to exist when building dependencies.
Creating $(OBJECTDIR) on-demand ensures it is present when needed.

Removed creation of $(OBJECTDIR) on initial read, and added an order-only
dependency forcing its creation all Makefile* rules where the target is
explicitly or implicitly in $(OBJECTDIR).
2013-06-20 17:45:41 -05:00
George Oikonomou 704309cfd4 Change the InfoPage Location of the IEEE address 2013-04-17 15:44:01 +01:00
George Oikonomou 8b5b2bd4d8 CC2538 Documentation typo and grammar fixes 2013-04-17 15:41:41 +01:00
George Oikonomou 007e113ea9 Improve handling of CDC ACM line state
- For the CC2538, simplify handling of USB_CDC_ACM_LINE_STATE
  events. Ignore the Carrier Control (RTS) bit when receiving
  a SET_CONTROL_LINE _STATE request, we are a full duplex device.
- Improve behaviour of the CC2531 USB stick when there is no
  process on the host to read IN data. Basically, we adopt the
  CC2538 approach and we only send data when a DTE is present
2013-04-16 15:49:05 +01:00
George Oikonomou 40f49948e6 New Platform: TI CC2538 Development Kit
This commit adds cpu, platform and example files,
providing support for running Contiki on TI's cc2538 DK
2013-04-06 21:07:31 +01:00