Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
86 changes: 80 additions & 6 deletions Arduino/platformio.ini
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,84 @@

[platformio]
src_dir = .
build_dir = .pioenvs
default_envs = CCDebug

[common]
framework = arduino
board = esp01_1m
board_build.flash_mode = dout

platform = espressif8266@~2.3.0
build_flags = -D NDEBUG
-mtarget-align
-Wl,-Map,firmware.map
-Wl,-Teagle.flash.1m.ld
-DBEARSSL_SSL_BASIC
; NONOSDK221
; -DPIO_FRAMEWORK_ARDUINO_ESPRESSIF_SDK221
; NONOSDK22x_190313
; -DPIO_FRAMEWORK_ARDUINO_ESPRESSIF_SDK22x_190313
; NONOSDK22x_190703 (Tasmota default)
-DPIO_FRAMEWORK_ARDUINO_ESPRESSIF_SDK22x_190703
; NONOSDK22x_191024
; -DPIO_FRAMEWORK_ARDUINO_ESPRESSIF_SDK22x_191024
; NONOSDK22x_191105
; -DPIO_FRAMEWORK_ARDUINO_ESPRESSIF_SDK22x_191105
; NONOSDK3V0 (known issues)
; -DPIO_FRAMEWORK_ARDUINO_ESPRESSIF_SDK3
; lwIP 1.4
; -DPIO_FRAMEWORK_ARDUINO_LWIP_HIGHER_BANDWIDTH
; lwIP 2 - Low Memory
; -DPIO_FRAMEWORK_ARDUINO_LWIP2_LOW_MEMORY
; lwIP 2 - Higher Bandwidth
; -DPIO_FRAMEWORK_ARDUINO_LWIP2_HIGHER_BANDWIDTH
; lwIP 2 - Higher Bandwidth Low Memory no Features
; -DPIO_FRAMEWORK_ARDUINO_LWIP2_LOW_MEMORY_LOW_FLASH
; lwIP 2 - Higher Bandwidth no Features (Tasmota default)
-DPIO_FRAMEWORK_ARDUINO_LWIP2_HIGHER_BANDWIDTH_LOW_FLASH
; VTABLES in Flash (Tasmota default)
-DVTABLES_IN_FLASH
; VTABLES in Heap
; -DVTABLES_IN_DRAM
; VTABLES in IRAM
; -DVTABLES_IN_IRAM
; enable one option set -> No exception recommended
; No exception code in firmware
-fno-exceptions
-lstdc++
; Exception code in firmware /needs much space! 90k
; -fexceptions
; -lstdc++-exc


; *** Fix espressif8266@1.7.0 induced undesired all warnings
build_unflags = -Wall

; set CPU frequency to 80MHz (default) or 160MHz
board_build.f_cpu = 80000000L
;board_build.f_cpu = 160000000L

monitor_speed = 115200
upload_speed = 115200
upload_resetmethod = nodemcu

; *** Upload Serial reset method for Wemos and NodeMCU
upload_port = COM5



[env:CCDebug]
platform = ${common.platform}
framework = ${common.framework}
board = ${common.board}
board_build.flash_mode = ${common.board_build.flash_mode}
board_build.f_cpu = ${common.board_build.f_cpu}
build_unflags = ${common.build_unflags}
build_flags = ${common.build_flags}
monitor_speed = ${common.monitor_speed}
upload_port = ${common.upload_port}
upload_resetmethod = ${common.upload_resetmethod}
upload_speed = ${common.upload_speed}
extra_scripts = ${common.extra_scripts}

[env:d1_mini]
platform = espressif8266@~2.2.2 ; v2.5.2
board = d1_mini
framework = arduino
;monitor_speed = 19200
;upload_speed = 921600
53 changes: 12 additions & 41 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,17 @@ This fork from CCLib is meant to simplify the flashing of CC2530 devices with a

It is based on this [fork](https://github.com/kirovilya/CCLib) from `kirovilya` and instructions described in this [blog post](https://www.zigbee2mqtt.io/information/alternative_flashing_methods.html).

The port speed is reduced to 19200 to avoid communication errors :`ERROR: Could not read from the serial port!`

Default pinout is the following:

- `GPIO4` connected to `CC_DC` aka `P2_2` or `Debug Clock`
- `GPIO5` connected to `CC_RST`
- `GPIO12`connected to `CC_DD` aka `P2_1` or `Debug Data`
- `GPIO4 (D2)` connected to `CC_DC` aka `P2_2` or `Debug Clock`
- `GPIO5 (D1)` connected to `CC_RST`
- `GPIO12 (D6)`connected to `CC_DD` aka `P2_1` or `Debug Data`

Pinout CC2530:
[![layout](https://github.com/Jason2866/CCLib/blob/master/cc2530_pin_layout.png)](https://github.com/Jason2866/CCLib/blob/master)

Pinout CC2530 + CC2591
[![Pinlayout](https://github.com/Jason2866/CCLib/blob/master/webee_cc2530_cc2591_pinlayout.png)](https://github.com/Jason2866/CCLib/blob/master)

Tasmota Zigbee currenlty only supports **ZNP 1.2 default mode** for coordinator. CCLib requires to remove the second last line.

Expand Down Expand Up @@ -53,7 +57,7 @@ Debug config:
[ ] TIMER_SUSPEND
```

To flash the firmware, use the following command: (flashing takes \~1 hours)
To flash the firmware, use the following command: (flashing takes \~20 minutes)

```python Python/cc_write_flash.py -e -p /dev/cu.usbserial-1420 -i Bin/CC2530_DEFAULT_20190608_CC2530ZNP-Prod.hex```

Expand Down Expand Up @@ -105,47 +109,14 @@ Once flashed, the recommended connection to Wemos D1 mini is:

# CCLib

[![Build Status (Travis)](https://travis-ci.org/wavesoft/CCLib.svg?branch=master)](https://travis-ci.org/wavesoft/CCLib) [![Build Status (AppVeyor)](https://img.shields.io/appveyor/ci/wavesoft/CCLib/master.svg)](https://ci.appveyor.com/project/wavesoft/cclib) [![Join the chat at https://gitter.im/Arduino-CCLib](https://badges.gitter.im/Arduino-CCLib.svg)](https://gitter.im/Arduino-CCLib)

A set of utilities to convert your Arduino board to a CC.Debugger for flashing Texas Instruments' CCxxxx chips.
It currently supports the CC2530/40/41 chips ([compatibility table](#compatibility-table)) but with [your help it can support any chip](#contributing-other-chip-drivers) compatible with the CC.Debugger protocol.

Keep in mind but this more than just a set of utilities! It comes with complete, reusable Arduino and Python libraries for adding CC.Debugger support to your projects!

## Usage

If you are just in hurry to flash your CCxxxx chip, follow this guide, however you should first check the [compatibility table](#compatibility-table) later in this document!

### 1. Prepare your arduino board

1. Install the `Arduino/CCLib` library [to your arduino IDE](https://www.arduino.cc/en/Guide/Libraries)
2. Load the `CCLib_proxy` example and change the the `LED`, `CC_RST`, `CC_DC`, `CC_DD_I` and `CC_DD_O` constants to match your configuration.
3. Flash it to your Teensy/Arduino
4. We are going to need a voltage divider from 5V (arduino) to 3.3V (CCxxxx chip), therefore you will need to wire your arduino according to the following diagram:

```
For the DD Pin:

<CC_DD_O> --[ 100k ]-- <CC_DD_I> --[ 200k ]-- <GND>
|
{DD}

For the DC Pin:

<CC_DC> --[ 100k ]-- {DC} --[ 200k ]-- <GND>

For the RST Pin:

<CC_RST> --[ 100k ]-- {RST} --[ 200k ]-- <GND>
```

Where `{DD}`, `{DC}` and `{RST}` are the pins on the CCxxxx chip and `<CC_DD_O>`, `<CC_DD_I>`, `<CC_DC>`, `<CC_RST>` are the pins in your ardiuno board.

In an arduino/breadboard set-up, this looks like this:

<img src="https://raw.githubusercontent.com/wavesoft/CCLib/master/Schematic/arduino-wiring.png" width="550" />

### 2. Prepare your software
### Prepare your software

1. You will need Python 2.7 or later installed to your system
2. Open a terminal and change directory into the `Python` folder of this project
Expand Down Expand Up @@ -183,7 +154,7 @@ Device information:
PC : 0000
```

### 3. Using the software
### Using the software

The python utilities provide a straightforward interface for reading/writing to your CCxxxx chip:

Expand Down
Binary file added cc2530_pin_layout.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added webee_cc2530_cc2591_pinlayout.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.