CCLib icon indicating copy to clipboard operation
CCLib copied to clipboard

Problem with CClib proxy

Open ArtemTomin opened this issue 8 years ago • 29 comments

Hello! I have such error after ./cc_info.py -p /dev/cu.usbmodem1411

ERROR: Could not find CCLib_proxy device on port /dev/cu.usbmodem1411

I use Arduino UNO

ArtemTomin avatar Dec 24 '16 14:12 ArtemTomin

Hello @ArtemTomin , it looks that the script cannot communicate with your Arduino on the port you specified.

I just pushed some changes on master that enable auto-detection. This means that cc_*.py scripts will now auto-detect where is the CCLib_proxy connected. Can you try updating to the current latest version and trying again, without specifying any -p or CC_SERIAL environment variable?

wavesoft avatar Dec 24 '16 23:12 wavesoft

Dear @wavesoft, The some problem, but o lil bit different error: ERROR: Could not detect a CCLib_proxy connected on any serial port

ArtemTomin avatar Dec 25 '16 10:12 ArtemTomin

Hey @ArtemTomin , It looks that there is a problem with the pyserial library. I think I have fixed it on the current master (just pushed another commit) can you try it and let me know?

wavesoft avatar Dec 25 '16 10:12 wavesoft

Hi @wavesoft, Thank you for such urgent help. But, unfortunately, it still doesn't work. Now, after ./cc_info.py or ./cc_info.py -p /dev/cu.usbmodem1411 just no reaction. Just is blinked cursor.

ArtemTomin avatar Dec 25 '16 15:12 ArtemTomin

default

ArtemTomin avatar Dec 25 '16 15:12 ArtemTomin

Hey @ArtemTomin , do you see the Arduino LED standing still? If yes, can you try unplugging & plugging it again?

Also, try to use the latest Arduino library. I just pushed some changes that prohibits this lockdown from happening again.

wavesoft avatar Dec 26 '16 11:12 wavesoft

Hi @wavesoft, Should I try with connected CC device, such as BLE112? Now, the some trouble. But i didn't connect any device, only arduino UNO. Did you see my screenshot?

ArtemTomin avatar Dec 26 '16 17:12 ArtemTomin

Hey @ArtemTomin , unfortunately I can't see your screenshot. You don't have to have a CC device connected to get a handshake confirmation. You should get a warning regarding wrong wiring. Are you sure the Arduino sketch is the correct?

wavesoft avatar Dec 26 '16 20:12 wavesoft

Hi @wavesoft, I use simple Arduino UNO, I've uploaded your sketch from Example folder without any changes.

ArtemTomin avatar Dec 26 '16 20:12 ArtemTomin

Ok, that's interesting. I from the port name I guess you are on Mac OSX? Which version? And which Python version are you using?

wavesoft avatar Dec 26 '16 20:12 wavesoft

Can you also try to do a manual ping to see if there is something wrong? You can type the following:

~$ dd if=/dev/cu.usbmodem1411 bs=3 count=1 | hexdump -C&
~$ echo -ne '\xF0\x01\x01\x01' >  /dev/cu.usbmodem1411

If everything goes well you should see something like this:

[1] 12345
1+0 records in
1+0 records out
3 bytes transferred in 4.939679 secs (1 bytes/sec)
00000000  01 00 00                                          |...|
00000003
[1]+  Done                    dd if=/dev/cu.usbmodem1411 bs=3 count=1 | hexdump -C

If not, something is wrong with your set-up.

wavesoft avatar Dec 26 '16 20:12 wavesoft

I see this: [1] 24406 iMac-Artem:~ Artem$ 1+0 records in 1+0 records out 3 bytes transferred in 0.000024 secs (125829 bytes/sec) 00000000 41 69 38 |Ai8| 00000003

[1]+ Done dd if=/dev/cu.usbmodem1411 bs=3 count=1 | hexdump -C

ArtemTomin avatar Dec 26 '16 21:12 ArtemTomin

When I try to connect with ./cc_info.py -p /dev/cu.usbmodem1411 I see just frozen cursor. If i disconnect Arduino, i see immediately ERROR: Could not find CCLib_proxy device on port /dev/cu.usbmodem1411

ArtemTomin avatar Dec 26 '16 21:12 ArtemTomin

The response that I see there does not really look like the one that I would expect from the sketch. Are you sure that's the correct port? Could it be that there are 2 ports for the arduino board? One for the bootloader and one for the serial port?

I haven't used an Arduino UNO, so I can't say for sure.

wavesoft avatar Dec 26 '16 23:12 wavesoft

I use OS X El Capitan. Python 3. Yes, this is correct port, i use it other my application with arduino and it works fine. There is only one port. My Mac see this port and bluetooth, that all.

ArtemTomin avatar Dec 27 '16 07:12 ArtemTomin

Hey @ArtemTomin , that looks like ASCII output. Can you try connecting using the Arduino Serial Monitor, type something random and hit enter? We might get something more useful out of it.

wavesoft avatar Dec 27 '16 10:12 wavesoft

Hi @wavesoft ! I did it, speed is 9600. Response is just ????????? Unreadable symbols.

ArtemTomin avatar Dec 27 '16 20:12 ArtemTomin

Hello, @wavesoft, I have the same problem as @ArtemTomin, but I use OS Windows for this. The symptoms are the same - when I launch cc_info.py I get a frozen cursor and when disconnect USB cable out of Arduino UNO, it says ERROR: Could not find CCLib_proxy device on port com14. I use Python 2.7, Win7 x64, Arduino UNO, the sketch is without any modifications - as in your library. I am going to flash BLE113 - so I could test the solution for CC2541. Urgently need help. Thank you.

Ivening avatar Jan 17 '17 19:01 Ivening

Did you ever get this resolved? I am running into the same issues. It seems that the proxy is ok when I send manual commands using Realterm. Maybe this in the version of pyserial that is used.

Before digging further, did anyone get this resolved?

maartendamen avatar Nov 08 '17 13:11 maartendamen

I have the same problem using a Wemos D1 mini. Tried two different MacBooks and different versions of pyserial. How can I debug this?

❯ dd if=/dev/cu.wchusbserial1410 bs=3 count=1 | hexdump -C&
[1] 84442 84443

1+0 records in
1+0 records out
00000000  01 00 00                                          |...|
00000003
3 bytes copied, 0.000429 s, 7.0 kB/s
[1]  + 84442 done       dd if=/dev/cu.wchusbserial1410 bs=3 count=1 |
       84443 done       hexdump -C
~/zigbee/CCLib/Python master*
❯ echo -ne '\xF0\x01\x01\x01' > /dev/cu.wchusbserial1410

❯ python cc_info.py -p /dev/cu.wchusbserial1410
ERROR: Could not find CCLib_proxy device on port /dev/cu.wchusbserial1410

vogler avatar Dec 19 '18 00:12 vogler

The originally raised IOError is ERROR: CCDebugger responded with an unknown status (0xa4) where the status changes (b4, c8, c8, ca, b4, b2, 30, ...). Tried pyserial 3.0.1 and 3.4. Python is 2.7.15.

vogler avatar Dec 19 '18 00:12 vogler

Tried it on my Windows PC and it works 🤔 At least the Wemos D1 mini replied correctly right away. For it to be able to talk to the CC2531, I had to add the -E option - before that I just got No chip found. Check your connection and/or wiring!.

vogler avatar Dec 19 '18 20:12 vogler

@vogler, can you explain or write the whole line where you used the -E?

@wavesoft, I have spent a few hours, but all I get on my Arduino Mega is this: ERROR: Could not detect a CCLib_proxy connected on any serial port I just flashed the BLINK-code to make sure the Arduino works, it does. When I call cc_info.py the LED flashes like 2,5 times and then dark. Here ^CERROR: I hit Ctrl+c after couple seconds. How could I dig deeper to see at which level it gets stuck? Another way to debug?

Ubuntu Mate 18.04 - Arduino Mega 2560 - CC2531 Stick

crw-rw---- 1 root dialout 166, 0 Mai 29 19:29 /dev/ttyACM0

python-serial  3.4-2  all pyserial - module encapsulating access for the serial port


Python 2.7.15rc1

python cc_info.py
NOTE: Performing auto-detection (use -p to specify port manually)
INFO: Checking /dev/ttyACM0
^CERROR: Could not detect a CCLib_proxy connected on any serial port

sudo python cc_info.py 
NOTE: Performing auto-detection (use -p to specify port manually)
INFO: Checking /dev/ttyACM0
^CERROR: Could not detect a CCLib_proxy connected on any serial port


Python 3.6.7

python3 cc_info.py
NOTE: Performing auto-detection (use -p to specify port manually)
INFO: Checking /dev/ttyACM0
ERROR: Could not detect a CCLib_proxy connected on any serial port

sudo python3 cc_info.py
NOTE: Performing auto-detection (use -p to specify port manually)
INFO: Checking /dev/ttyACM0
ERROR: Could not detect a CCLib_proxy connected on any serial port

python3 cc_info.py -p /dev/ttyACM0
ERROR: unicode strings are not supported, please encode to bytes: 'ð\x00\x00\x00'
 - on github issue #5


Manual Ping:
$ dd if=/dev/ttyACM0 bs=3 count=1 | hexdump -C&
[1] 13599
$ 0+0 Datensätze ein
0+0 Datensätze aus
0 Bytes kopiert, 0.00838095 s, 0.0 kB/s

echo -ne '\xF0\x01\x01\x01' >  /dev/ttyACM0
[1]+  Fertig                  dd if=/dev/ttyACM0 bs=3 count=1 | hexdump -C```

tido- avatar May 29 '19 18:05 tido-

@tido Since Windows' cmd doesn't persist history I can't look it up, but I think it was just what I wrote above, i.e., python2 cc_info.py -E. I tried to get it to work on macOS before, but that somehow didn't work.

https://github.com/wavesoft/CCLib/blob/master/Python/cclib/ccproxy.py#L134 From your output it seems like with Python 2 this line blocks, while with Python 3 it throws. Maybe print those exceptions to debug.

vogler avatar Jun 05 '19 08:06 vogler

@vogler, thank you for your quick reply. I tried it with your line.. still doesn't work. Line 134, you mean to change the python code so, that it prints more details, than just the line @wavesoft defined? How would you change the code ... I only read a book about C.

It looks like that wavesoft has abandoned, this neat work of his, two open commits are not merged.. if I am not wrong. I looked now at the FORKS and this: https://github.com/kirovilya/CCLib was reForked a couple times and even in 2019 accepted commits.

tido- avatar Jun 15 '19 14:06 tido-

Then I would try this fork - the commits say it's adjusted for Python 3. https://github.com/wavesoft/CCLib/blob/master/Python/cclib/ccproxy.py#L138-L143 You could just remove this try/catch to see which exception was thrown originally.

vogler avatar Jun 15 '19 16:06 vogler

if you have a Raspberry Pi (I am not a fan) you can just connect it and flash it. I wasted hours on the Arduino /ESP32 ideas. This just worked: https://github.com/jmichault/flash_cc2531

tido- avatar Aug 02 '19 17:08 tido-

Hi, I also struggled some time with this problem (Windows 10 64 bits) Pyserial is installed! python C:\Users\etadmin\Downloads\CCLib-master\CCLib-master\Python\cc_info.py NOTE: Performing auto-detection (use -p to specify port manually) INFO: Checking COM11 ERROR: Could not detect a CCLib_proxy connected on any serial port

This starts python3 on my computer! After installing pyserial for Python27 C:\Python27\python.exe -m pip install pyserial==3.0.1 (updating pip C:\Python27\python.exe -m pip install --upgrade pip)

it works C:\Python27\python.exe C:\Users\etadmin\Downloads\CCLib-master\CCLib-master\Python\cc_info.py -p COM11 INFO: Found a CC2530 chip on COM11

Chip information: Chip ID : 0xa524 Flash size : 16 Kb Page size : 2 Kb SRAM size : 1 Kb USB : No

Device information: IEEE Address : 000000000000 PC : 0000

Debug status: [ ] CHIP_ERASE_BUSY [ ] PCON_IDLE [X] CPU_HALTED [ ] PM_ACTIVE [ ] HALT_STATUS [X] DEBUG_LOCKED [X] OSCILLATOR_STABLE [ ] STACK_OVERFLOW

Debug config: [ ] SOFT_POWER_MODE [ ] TIMERS_OFF [ ] DMA_PAUSE [ ] TIMER_SUSPEND

With this resolved I could follow the instructions on https://github.com/arendst/Tasmota/wiki/Zigbee

Regards

connermacleod69 avatar Feb 28 '20 11:02 connermacleod69

On OSX I could solve this by adding:

self.ser.reset_input_buffer()
self.ser.reset_output_buffer()

after time timeout in the routine that opens the serial port.

Apparently there are some characters in the input/output buffers. The current code does´t know how to 'align' itself so clearing the buffers helps here.

rvt avatar May 31 '20 20:05 rvt