Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Wiring other cc2530 to USB TTL #231

Closed
mark078 opened this issue Jul 30, 2018 · 14 comments
Closed

Wiring other cc2530 to USB TTL #231

mark078 opened this issue Jul 30, 2018 · 14 comments

Comments

@mark078
Copy link

mark078 commented Jul 30, 2018

Hi and first thanks very much for this great project! :)

Any of you guys successfully run a CC2530 like this?
https://de.aliexpress.com/item/ZigBee-Wireless-Module-CC2530-Module-Internet-Of-Things-Core-Board/32503616246.html

Firmware flash are fine, with the Cordinator FW for CC2530. Only the connection to USB TTL does not work.
Neither with P20 on GND or without it. I tried to swap RX/TX without success.
Does this CC2530 require a different connection?

2018-7-30 15:48:08 ERROR Error while starting zigbee-shepherd!
2018-7-30 15:48:08 ERROR Press the reset button on the stick (the one closest to the USB) and start again
2018-7-30 15:48:08 ERROR Failed to start
        {"message":"request timeout","stack":"Error: request timeout\n    at CcZnp.<anonymous> (/opt/zigbee2mqtt/node_modules/cc-znp/lib/ccznp.js:254:22)\n    at Object.onceWrapper (events.js:315:30)\n    at emitOne (events.js:116:13)\n    at CcZnp.emit (events.js:211:7)\n    at Timeout.<anonymous> (/opt/zigbee2mqtt/node_modules/cc-znp/lib/ccznp.js:233:18)\n    at ontimeout (timers.js:498:11)\n    at tryOnTimeout (timers.js:323:5)\n    at Timer.listOnTimeout (timers.js:2

I flashed the router firmware (without P20 to GND) and this worked. But I would like to use it serially...

Another CC2530 works with my usb ttl converter.
https://de.aliexpress.com/item/CC2530-Zigbee-UART-Wireless-Core-Board-Development-Board-CC2530F256-Serial-Port-Wireless-Module-24MHz/32767470382.html

Connection:

TX = P0_3
RX = P0_2
GND = GND
3v3 = VCC
P20 to GND

Thanks!

@ptvoinfo
Copy link
Contributor

Hello,

I've struggled with this board some time ago. Wait a minute and the standard coordinator firmware will start or use my version:
http://ptvo.info/cc2530-based-zigbee-coordinator-and-router-112/

@mark078
Copy link
Author

mark078 commented Jul 30, 2018

Hi ptvoinfo,

Yeah, I've been struggling for a few days, too. :D

I flashed your coordinator version (CC2530ZNP-Pro-Secure_LinkKeyJoin.hex.hex)
Now the second LED lights up blue. But I still can't get a connection.

What about P20 to GND? Connect, yes or no?
I tried both again. So P20 to GND (and without), 1 minute waited, but I have no luck.

There is enough power, the Arduino Nano (reset shorted to gnd) hangs on a USB hub with power supply.

Do you have any other ideas?

@kirovilya
Copy link
Contributor

@mark078

TX = P0_3
RX = P0_2
GND = GND
3v3 = VCC
P20 to GND

It is correct wiring. Try to change rtscts to false in advanced settings data/configuration.yaml:

  # Optional: RTS / CTS Hardware Flow Control for serial port
  rtscts: false

@mark078
Copy link
Author

mark078 commented Jul 30, 2018

Unfortunately, "rtscts: false" does not work either.

I have already tried another TTL USB converter, but that was not the issue.
What works is the router FW with router operation. But coordinator FW with Zigbee2mqtt does not work:

root@raspberrypi:/opt/zigbee2mqtt# DEBUG="$DEBUG" npm start

> [email protected] start /opt/zigbee2mqtt
> node index.js

2018-7-30 19:56:36 INFO Starting zigbee2mqtt version 0.1.0 (commit #ae41b7b)
2018-7-30 19:56:36 INFO Starting zigbee-shepherd
2018-7-30 19:56:40 INFO Error while starting zigbee-shepherd, attemping to fix... (takes 60 seconds)
2018-7-30 19:57:40 INFO Starting zigbee-shepherd
2018-7-30 19:57:43 ERROR Error while starting zigbee-shepherd!
2018-7-30 19:57:43 ERROR Press the reset button on the stick (the one closest to the USB) and start again
2018-7-30 19:57:43 ERROR Failed to start
        {"message":"request timeout","stack":"Error: request timeout\n    at CcZnp.<anonymous> (/opt/zigbee2mqtt/node_modules/cc-znp/lib/ccznp.js:254:22)\n    at Object.onceWrapper (events.js:315:30)\n    at emitOne (events.js:116:13)\n    at CcZnp.emit (events.js:211:7)\n    at Timeout.<anonymous> (/opt/zigbee2mqtt/node_modules/cc-znp/lib/ccznp.js:233:18)\n    at ontimeout (timers.js:498:11)\n    at tryOnTimeout (timers.js:323:5)\n    at Timer.listOnTimeout (timers.js:290:5)"}
root@raspberrypi:/opt/zigbee2mqtt# cat data/configuration.yaml
homeassistant: false
permit_join: true
mqtt:
  base_topic: zigbee2mqtt
  server: 'mqtt://localhost'
serial:
  port: >-
    /dev/serial/by-id/usb-1a86_USB2.0-Serial-if00-port0
devices:
  '0x00158d00016d7946':
    friendly_name: '0x00158d00016d7946'
    retain: false

advanced:
# Optional: RTS / CTS Hardware Flow Control for serial port
  rtscts: false

Here are some pictures, I just soldered it together quickly and measured through.
https://www.dropbox.com/sh/9y6fu012ci7filj/AAD4aojRZ5p8pORh9t26xkkma?dl=0
(Arduino Nano, reset shorted to gnd for UART)

Btw. is the "Serial Monitor" output on arduino IDE normal?

I think I'll give up for now. this cc2530 version seems to be jinxed.

@kirovilya
Copy link
Contributor

@mark078 Hmm, you used Arduino as USB ttl converter? Is you second cc2530 board works fine with this connections?

Router FW no needs connected to UART, so it is works fine.

@kirovilya
Copy link
Contributor

@mark078 Also try set port speed baudrate: 115200 with rtscts: false

@mark078
Copy link
Author

mark078 commented Jul 30, 2018

Yes Arduino as USB TTL converter.

My second cc2530 board is a different one. With these I don't have the problems:
https://de.aliexpress.com/item/CC2530-Zigbee-UART-Wireless-Core-Board-Development-Board-CC2530F256-Serial-Port-Wireless-Module-24MHz/32767470382.html

Router FW no needs connected to UART, so it is works fine.

I know. But if the router FW works, the board doesn't seem to be defective. That's what i meant.

Also try set port speed baudrate: 115200 with rtscts: false

Unfortunately, that didn't help either. :(

@ptvoinfo
Copy link
Contributor

@mark078

My firmware uses:

baudrate: 115200
rtscts: false
P20 does not matter

If you are using Arduino as USB TTL converter I hope you use a 3.3V version of Arduino and your Arduino firmware does not use RTS/CTS handshaking.

@mark078
Copy link
Author

mark078 commented Jul 31, 2018

No, that's a 5 volt Arduino nano, VCC is at 3.3 volts. But I guess not the data lines. :D

I flashed this one in the beginning by "Alternative firmware flashing methods".
Maybe something broke in the process...
Since a few days I have a real debugger.

I connected the CC2530 to an FTDI USB to TTL Serial Converter yesterday, but it doesn't work either.
I'm served too. I just order another CC2530 and the jinxed one, can still use it as a router.

Thanks for your help anyway! :)

@marionos
Copy link

@mark078

Hello, sorry for annoying but didn't find any other way to reach out to you.
Got a question, as I have recently got myself this C2530 board https://de.aliexpress.com/item/CC2530-Zigbee-UART-Wireless-Core-Board-Development-Board-CC2530F256-Serial-Port-Wireless-Module-24MHz/32767470382.html and noticed you have managed to get it working. I however struggle a lot to get it wired properly. I am using a Bus Pirate as the UART to USB but no matter how I wire the C2530 board I cant get it to work. Only thing I was successful with was to wire the C2530 to CCDebugger and write the zigbee2mqtt firmware on it. Any chance you could reach out to me with some sort of how to? I would really appreciate it.

@CodeFinder2
Copy link

Yeah I would appreciate some kind of a tutorial on this as well.

I own a CC2350:

and a USB-to-Serial:

And I have successfully flashed the coordinator FW ( https://github.com/Koenkk/Z-Stack-firmware/blob/master/coordinator/CC2530/bin/CC2530ZNP-Prod_20190223.zip ) but I am not able to get it working using a USB-to-Serial adapter: I am always getting
$ ls -l /dev/serial/by-id insgesamt 0 lrwxrwxrwx 1 root root 13 Mär 24 20:33 usb-Silicon_Labs_CP2102_USB_to_UART_Bridge_Controller_0001-if00-port0 -> ../../ttyUSB0

after plugging it into an USB port. And I would expect to see something like /ttyAMA0 that reports itself as being some TI CC2530 device... (I did not try to use it along with zigbee2mqtt yet)

PS: I've tried https://www.zigbee2mqtt.io/how_tos/how_to_connect_a_cc2530_coordinator_using_a_usb_to_serial_adapter.html but it doesn't work.

@mcsSolutions
Copy link

I have same experience as Mark078. My unit is https://www.aliexpress.com/item/ZigBee-Wireless-Module-CC2530-CC2591-PA-Module/1831284083.html?spm=a2g0s.9042311.0.0.b9b74c4dxZ8wmN
No issues flashing it with router firmware and it functions properly. When flashed with coordinator https://github.com/Koenkk/Z-Stack-firmware/tree/master/coordinator/default/CC2530_CC2591 and interfaced with 3.3v USB/Serial then only get timeouts from zigbee-shepherd. Tried all suggestions in this and another thread. Tried two different USB/Serial that were both known good in other uses. The unit shows up as ttyUSB0 and that is what was used in configuration.yaml.

It seems the pinout mapping is not working for us to get serial communications.

zigbee2mqtt:info 2019-4-7 16:26:59 Logging to directory: '/opt/zigbee2mqtt/data/log/2019-04-07.16-26-59'
zigbee2mqtt:debug 2019-4-7 16:26:59 Removing old log directory '/opt/zigbee2mqtt/data/log/2019-04-07.15-30-33'
zigbee2mqtt:debug 2019-4-7 16:27:00 Using zigbee-shepherd with settings: '{"net":{"panId":6754,"extPanId":[221,221,221,221,221,221,221,221],"channelList":[11],"precfgkey":"HIDDEN"},"dbPath":"/opt/zigbee2mqtt/data/database.db","sp":{"baudRate":115200,"rtscts":false}}'
zigbee2mqtt:debug 2019-4-7 16:27:00 Loaded state from file /opt/zigbee2mqtt/data/state.json
zigbee2mqtt:debug 2019-4-7 16:27:00 Saving state to file /opt/zigbee2mqtt/data/state.json
zigbee2mqtt:info 2019-4-7 16:27:00 Starting zigbee2mqtt version 1.2.1 (commit #32db1fd)
zigbee2mqtt:info 2019-4-7 16:27:00 Starting zigbee-shepherd
zigbee2mqtt:info 2019-4-7 16:27:25 Error while starting zigbee-shepherd, attempting to fix... (takes 60 seconds)
zigbee2mqtt:info 2019-4-7 16:28:25 Starting zigbee-shepherd
zigbee2mqtt:error 2019-4-7 16:28:28 Error while starting zigbee-shepherd!
zigbee2mqtt:error 2019-4-7 16:28:28 Press the reset button on the stick (the one closest to the USB) and start again
zigbee2mqtt:error 2019-4-7 16:28:28 Failed to start
{"message":"request timeout","stack":"Error: request timeout\n at CcZnp. (/opt/zigbee2mqtt/node_modules/cc-znp/lib/ccznp.js:268:22)\n at Object.onceWrapper (events.js:315:30)\n at emitOne (events.js:116:13)\n at CcZnp.emit (events.js:211:7)\n at Timeout. (/opt/zigbee2mqtt/node_modules/cc-znp/lib/ccznp.js:247:18)\n at ontimeout (timers.js:498:11)\n at tryOnTimeout (timers.js:323:5)\n at Timer.listOnTimeout (timers.js:290:5)"}
zigbee2mqtt:error 2019-4-7 16:28:28 Exiting...
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! [email protected] start: node index.js
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the [email protected] start script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR! /root/.npm/_logs/2019-04-07T23_28_28_392Z-debug.log

@CodeFinder2
Copy link

CodeFinder2 commented Apr 14, 2019

Okay, appears working now:

$ npm start

> [email protected] start /opt/zigbee2mqtt
> node index.js

  zigbee2mqtt:info 2019-4-14 23:47:17 Logging to directory: '/opt/zigbee2mqtt/data/log/2019-04-14.23-47-17'
  zigbee2mqtt:info 2019-4-14 23:47:17 Starting zigbee2mqtt version 1.3.0 (commit #00ebd44)
  zigbee2mqtt:info 2019-4-14 23:47:17 Starting zigbee-shepherd
  zigbee2mqtt:info 2019-4-14 23:47:22 zigbee-shepherd started
  zigbee2mqtt:info 2019-4-14 23:47:22 Coordinator firmware version: '20190223'
  zigbee2mqtt:info 2019-4-14 23:47:22 Currently 0 devices are joined:
  zigbee2mqtt:warn 2019-4-14 23:47:22 `permit_join` set to  `true` in configuration.yaml.
  zigbee2mqtt:warn 2019-4-14 23:47:22 Allowing new devices to join.
  zigbee2mqtt:warn 2019-4-14 23:47:22 Set `permit_join` to `false` once you joined all devices.
  zigbee2mqtt:info 2019-4-14 23:47:22 Zigbee: allowing new devices to join.
  zigbee2mqtt:info 2019-4-14 23:47:22 Connecting to MQTT server at mqtt://localhost
  zigbee2mqtt:info 2019-4-14 23:47:22 zigbee-shepherd ready
  zigbee2mqtt:info 2019-4-14 23:47:22 Connected to MQTT server
  zigbee2mqtt:info 2019-4-14 23:47:22 MQTT publish: topic 'zigbee2mqtt/bridge/state', payload 'online'
  zigbee2mqtt:info 2019-4-14 23:47:22 MQTT publish: topic 'zigbee2mqtt/bridge/config', payload '{"version":"1.3.0","commit":"00ebd44","coordinator_firmware":20190223,"log_level":"info","permit_join":true}'

For the records:

serial:
  baudrate: 115200
  port: /dev/ttyUSB0
advanced:
  rtscts: false

whereby /dev/ttyUSB0 is the appropriate adapter name (in case of the CC2530, it's most probably "/dev/ttyUSB0" and in case of the CC2531, it's most probably "/dev/ttyACM0").

I've not yet connected any devices but according to the above log, it seems to work just fine. I've just replaced my CC2531 with this CC2530 and all paired devices seem to work just fine without repairing as intended. :-) Hope this helps someone else having trouble to set this up. If yes, please give this post a thumps up so that we can somewhat "count" how many people where successfully in using this (and probably update the Wiki, if needed).

@SlavikS-PL
Copy link

Thanks for this description - it works for me, but I have a question about signal quality - lqi.
I've just tested 3 configurations:

  1. CC2531 (coordinator)
  2. CC2530+CC2591 (coordinator) and UART to USB converter FT232RL FT232 FTDI https://aliexpress.com/item/32263813490.html
  3. CC2531 (coordinator) and CC2530+CC2591 (router)

firmwares:

  1. https://github.com/Koenkk/Z-Stack-firmware/blob/master/coordinator/Z-Stack_Home_1.2/bin/default/CC2531_DEFAULT_20190608.zip

  2. https://github.com/Koenkk/Z-Stack-firmware/blob/master/coordinator/Z-Stack_Home_1.2/bin/default/CC2530_CC2591_DEFAULT_20190608.zip

  3. https://github.com/Koenkk/Z-Stack-firmware/blob/master/router/CC2530_CC2591/bin/CC2530_CC2591_router_2019_02.zip

After running each configuration in Home Assistant I observed my sensor's lqi levels.
My observations are as follows:

  • lqi levels on CC2531 are the worst
  • lqi levels on configuration 2 are a little bit better than configuration 1 - lqis raises about 10 - 15 lqi
  • lqi levels on configuration 2 are the best - lqis raises about 100

My question is, why in router mode the same hardware (CC2530+CC2591) works 10 times better then in coordinator mode? Or maybe there is no difference and it is some bug in firmware showing wrong lqis?

Is there any home made way to check/measure real signal level? It'll be nice to have powerful coordinator :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

7 participants