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

Problem with CClib proxy #14

Open
ArtemTomin opened this issue Dec 24, 2016 · 29 comments
Open

Problem with CClib proxy #14

ArtemTomin opened this issue Dec 24, 2016 · 29 comments

Comments

@ArtemTomin
Copy link

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

@wavesoft
Copy link
Owner

wavesoft commented Dec 24, 2016

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?

@ArtemTomin
Copy link
Author

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

@wavesoft
Copy link
Owner

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?

@ArtemTomin
Copy link
Author

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
Copy link
Author

default

@wavesoft
Copy link
Owner

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.

@ArtemTomin
Copy link
Author

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?

@wavesoft
Copy link
Owner

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?

@ArtemTomin
Copy link
Author

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

@wavesoft
Copy link
Owner

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
Copy link
Owner

wavesoft commented Dec 26, 2016

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.

@ArtemTomin
Copy link
Author

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
Copy link
Author

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

@wavesoft
Copy link
Owner

wavesoft commented Dec 26, 2016

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.

@ArtemTomin
Copy link
Author

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.

@wavesoft
Copy link
Owner

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.

@ArtemTomin
Copy link
Author

ArtemTomin commented Dec 27, 2016

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

@Ivening
Copy link

Ivening commented Jan 17, 2017

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.

@maartendamen
Copy link

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?

@vogler
Copy link

vogler commented Dec 19, 2018

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
Copy link

vogler commented Dec 19, 2018

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
Copy link

vogler commented Dec 19, 2018

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!.

@tido-
Copy link

tido- commented May 29, 2019

@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```

@vogler
Copy link

vogler commented Jun 5, 2019

@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.

@tido-
Copy link

tido- commented Jun 15, 2019

@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.

@vogler
Copy link

vogler commented Jun 15, 2019

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.

@tido-
Copy link

tido- commented Aug 2, 2019

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

@connermacleod69
Copy link

connermacleod69 commented Feb 28, 2020

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

@rvt
Copy link

rvt commented May 31, 2020

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.

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

8 participants