-
Notifications
You must be signed in to change notification settings - Fork 1
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
Supporting the CY7C65215 #3
Comments
Yeah frankly I'm shocked at how bad everything about the FT232H is. The example circuit uses a bajillion additional components and the datasheet is awful -- low res screenshots of example circuits, super unclear pin descriptions, you name it! Plus, when I tried it on my custom PCB I wasn't able to get it booting after like a month of on and off debugging. So I switched to Cypress parts, never to look back. Yeah, unfortunately this driver isn't totally set up for the dual channel devices yet. I realized that when I was writing it but didn't really have time to go back and add support. At present I don't actually have a dual channel device to test with, though I might pick one up at some point. The first thing we need to fix is the USB device scanning code in cy_scb_context.py, as you discovered. This code exists because these chips can have arbitrary VID/PID values, and I wanted a way to reliably detect them just based on their USB structure. So that I can update the detection code, could you run this detection script on your PC with the CY7C65215 attached? I will probably need one run with it in I2C, SPI, and UART modes. That should give me enough info to update the detection code. Alternately you're welcome to submit a patch if you are confident making the needed mods. After we fix that, the next step will be to update the driver code to properly distinguish SCB1 and SCB2. Currently some places are aware of the difference but other places aren't. We will probably need to add some new command line options as well. Last but not least, we will have to update the configuration code to be dual channel aware. I think the dual channel devices must use a somewhat different configuration format, so that will probably require some reverse engineering of the "set settings with USCU, then dump the config block" variety. |
I've actually made a bit of progress which I need to clean up and add to my PR... I've also started working on a flash.py CLI tool, since I think writing to flash memories or FPGAs will be a primary use case. The current SPI code in the cy_serial_cli is good for testing but not enough to properly interact with flash memories. So I'm trying to add a small tool that will speak to CFI-conformant devices and allow the user to read/write/erase the chips. I'll try to run the detection later today, or latest by end of week - I'm killer busy at the moment :-/ |
That would be awesome, thank you! |
Sorry for the delay... very busy at the moment, it took a while to fit this in. But I've finally done some more work on my PR and have checked the USB device infos for you now... For the screenshot and device scan below I had things configured with one CDC UART interface and one SPI interface on the two SCBs: USBProber Screengrab: Output of scan_device_tree.py:
I have committed the changes you requested to my fork, and the PR has updated. I think I'm part of the way towards a solution. The changes I have made are fundamentally this:
What's not yet working?
My proposal:
Furthermore:
|
Nice work on this refactoring! I definitely agree that the current code needs a lot of work for dual channel devices. I might suggest simply having one DiscoveredDevice object map to one SCB, so you would just return two DiscoveredDevices (one with scb = 0, one with scb = 1) when you encounter a dual channel device. |
Thank you for your excellent work on this library.
In your readme you write:
I agree very much with this statement. I think perhaps the reason the FT2232H is still widely used, is that is has better software support. Your library may go a long way to change that.
I'm trying to add support for the CY7C65215 chips, the dual channel versions of these chips. Compared to the FT2232H this chip also offers 2 serial channels configurable as either UART, SPI or I2C, but needs far fewer external components to support it, and comes in a smaller package at half the price.
In terms of the code, at the moment it does not work to connect to these chips. To get my local version to connect, I needed to change the
list_devices
function in cy_scb_context.py.There are significant differences to the USB device for the 2-channel version:
list_devices
accordingly, it connects to my CY7C65215 successfully.I'm happy to submit these changes as a PR, but I am uncertain regarding the best way to proceed.
What is the purpose of all these checks? Are you trying to recognise the device based on its interface and endpoint configuration? Why not trust the user-supplied PID values?
How to deal with the fact that there could be 2x UART or 2x SPI, etc? The CLI has the
--scb
option, but the SCBContext does not seem to take it into account?The text was updated successfully, but these errors were encountered: