Skip to content

The Drone-OS toolchain setup for Texas Instruments CC2538 System-on-Chip Solution for 2.4-GHz IEEE 802.15.4 and ZigBee®/ZigBee IP® Applications

Notifications You must be signed in to change notification settings

centosa/cc2538-starter

Repository files navigation

cc2538-starter

The Drone-OS toolchain setup for Texas Instruments CC2538 System-on-Chip Solution for 2.4-GHz IEEE 802.15.4 and ZigBee®/ZigBee IP® Applications.

Prerequisites:

  • Dev board with the CC2538 processor. Examples: Zolertia FireFly (tested), Zolertia Re-Mote (tested), Texas Instruments 2538DK (not tested).
  • Segger J-Link.
  • For debug/log: UART-to-USB adapter and cable to receive log output via a virtual COM-port on your computer.

Usage

Clone the repository inside a dedicated workspace folder like this:

mkdir mycc2538
cd mycc2538
git clone https://github.com/centosa/cc2538-starter.git

Inside the workspace folder, clone the latest Drone-OS crates:

git clone https://github.com/drone-os/drone.git
git clone https://github.com/drone-os/drone-core.git
git clone https://github.com/drone-os/drone-cortexm.git
git clone https://github.com/drone-os/drone-tisl-map.git
git clone https://github.com/drone-os/drone-svd.git

You will have to replace your currently installed drone utility with the most recent one:

cd mycc2538/drone-os/drone
just install

And then the following to compile and flash it to your Zolertia FireFly board (no other boards tested yet):

cd mycc2538/cc2538-starter
just flash

To receive logging messages (needs the UART-to-USB adapter connected to GND and pin PD2 as TX output:
just log

To debug interactively:
just gdb
If you want to single-step through your code, you should copy the Justfile.debug to Justfile and recompile.
With the release version, the binary is highly optimized and gdb won't catch it.

Configuring the DSO API (Drone Serial Logging)

As the CC2538 has no SWO module, DSO is our solution for sending logging output to your computer via UART-USB adapter. In this example. logging output is done to pin PD2, and PD0 for input. Altough the input pin is not used by DSO, it must be configured.

If your dev board does not allow you to access pin PD2 and PD0, you can re-configure the pins easlily. It is all done in the file src/lib.rs:

Example: you have the Re-MOTE board and want to use the following pins (a possible selection for Re-MOTE):

  • PC4 for TX (output)
  • PA0 for RX (input, inactive)
// Create the logger.
drone_cc2538_dso::set_log! {
    uart_ty: Uart0,      // One of Uart0, Uart1.
    pad_ty_tx: IocC4,    // Output pad type, range IocA0 .. IocD7.
    pad_ty_rx: IocA0,    // Input pad type, range IocA0 .. IocD7.
    baud_rate: 115200,   // Transmission speed.
}

One more change is needed: The DSO crate needs exclusive access to specific registers, which are no longer available to the application code. A registration macro in src/lib.rs grants access. The pin related registers reserved for the DSO are listed in the exclusion list, like, for instance, !ioc_pa0_sel. It means: the application code has no access to IOC_PA0_SEL register because the DSO crate is managing it.

tisl_reg_tokens! {
    /// A set of tokens for all memory-mapped registers.
    index => pub Regs;

    exclude => {
        uart0_ctl, uart0_ibrd, uart0_fbrd, uart0_lcr, uart0_fr, uart0_dr, uart0_im, uart0_cc,
        ioc_pd0_sel, ioc_pd0_over, ioc_pd2_sel, ioc_pd2_over,    
        ioc_uartrxd_uart0,

        scb_ccr,
        mpu_type, mpu_ctrl, mpu_rnr, mpu_rbar, mpu_rasr,
    }
}

License

Licensed under either of

at your option.

Contribution

Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the work by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.

About

The Drone-OS toolchain setup for Texas Instruments CC2538 System-on-Chip Solution for 2.4-GHz IEEE 802.15.4 and ZigBee®/ZigBee IP® Applications

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Languages