- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi everyone,
I used a CY5677 USB dongle with cysmart.py CySmart api.
Python script:
from CySmart import * import serial import time import binascii from struct import * import threading import Queue import sys import datetime def main(): cySmart = CySmart() cySmart.start(0x00, r'\.\COM5') cySmart.sendCommand(cySmart.Commands['CMD_START_SCAN']) cySmart.close() if __name__ == "__main__": main() |
After running the program I got a Timeout.
If I used the CySmart Debugger tool, everything was OK.
If I used the script above, I did not receive any data from USB dongle.
The CySmart.py script was waiting buffer data(self.serin.inwaiting()), but after timeout (2 sec), it was exited.
Any suggestion or advice?
Thanks so much.
- Labels:
-
BLE
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
An option might be to use wireshark to sniff what data the debugger is sending to the com port; This would allow more verification at a protocol level.
Regards,
Epratt
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I also face the problem, Anyone could give a hint?
Thank you.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
- It could be the COM port is incorrect for the enumeration of your device;
- Depending on if the cySmart.sendCommand(cySmart.Commands['CMD_START_SCAN']) function returns immediately, or returns after some amount of time receiving scans, then the code could be starting a scan and immediately return/exiting the script, causing the timeout error and not actually waiting until scan responses are received.
- Potentially, changing the scan settings from passive to active might have an affect on the results as well.
- The timeout on buffer serin data would seem to indicate that the USB dongle didn't send any more data; Depending on the API functionality, you might need to increase the timeout time or poll the responses of the scanning of the device.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Thank you for your reply.
I have been try your suggestion, but didn't work.
I have confuse about when i call cySmart.sendCommand(cySmart.Commands['CMD_START_SCAN']) function. It's return bool ('True') back to me. Is it correct that you think?
Below is Commands list in CySmart.py, Is it correct on CY5677?
Commands = {
'CMD_Resolve_and_Set_Peer_Device_BD_Address':binascii.unhexlify("A1FE"),
'CMD_Hedder':binascii.unhexlify("4359"),
'CMD_Footer':binascii.unhexlify("0000"),
'CMD_INIT_BLE_STACK':binascii.unhexlify("07FC"),
'CMD_START_SCAN':binascii.unhexlify("93FE"),
'CMD_STOP_SCAN':binascii.unhexlify("94FE"),
'CMD_ESTABLISH_CONNECTION':binascii.unhexlify("97FE"),
'CMD_TERMINATE_CONNECTION':binascii.unhexlify("98FE"),
'CMD_EXCHANGE_GATT_MTU_SIZE':binascii.unhexlify("12FE"),
'CMD_READ_CHARACTERISTIC_VALUE':binascii.unhexlify("06FE"),
'CMD_READ_USING_CHARACTERISTIC_UUID':binascii.unhexlify("07FE"),
'CMD_WRITE_CHARACTERISTIC_VALUE':binascii.unhexlify("0BFE"),
'CMD_WRITE_CHARACTERISTIC_VALUE_WITHOUT_RESPONSE':binascii.unhexlify("0AFE"),
'CMD_FIND_INCLUDED_SERVICES':binascii.unhexlify("02FE"),
'CMD_DISCOVER_ALL_CHARACTERISTICS':binascii.unhexlify("03FE"),
'CMD_INITIATE_PAIRING_REQUEST':binascii.unhexlify("99FE"),
'CMD_UPDATE_CONNECTION_PARAMETER_RESPONSE':binascii.unhexlify("9FFE")
}
very thanks for your help.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
If it is returning true, that could mean that it successfully sent the command. (most architecture would do it this way I think)
I'm not sure if the CySmart.py commands are the same for the CY5677; I don't work much with them to be able to confirm
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Thank you for your reply.
May i know which serial number of dongle can work with CySmart.py?
Should i change to CY5670?
Thank you very much.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I would expect the cysmart.py script to work. It might require a little editing to get it working?
I wouldn't think switching between the CY5677 and the CY5670 would make much difference, but you could see if that makes a difference.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Try baudrate 921600 for CY5677
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I think it is because there is no EVT_COMMAND_COMPLETE in scan response
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
In the link @hsin_2098976 posted there is a 047F CyBleEvtCmdComplete