AGB  ·  Datenschutz  ·  Impressum  







Anmelden
Nützliche Links
Registrieren
Zurück Delphi-PRAXiS Programmierung allgemein Win32/Win64 API (native code) Delphi Delphi 7, mit USB auf Cypress CY7C68013 FX2 zugreifen

Delphi 7, mit USB auf Cypress CY7C68013 FX2 zugreifen

Offene Frage von "jaenicke"
Ein Thema von max pack · begonnen am 14. Aug 2024 · letzter Beitrag vom 14. Feb 2025
Antwort Antwort
Benutzerbild von himitsu
himitsu

Registriert seit: 11. Okt 2003
Ort: Elbflorenz
44.343 Beiträge
 
Delphi 12 Athens
 
#1

AW: Delphi 7, mit USB auf Cypress CY7C68013 FX2 zugreifen

  Alt 14. Aug 2024, 18:04
Wenn das Ding so ein Ding sich selbst als COM-Port via USB ausgibt
und am Besten noch einen der 2 bzw. 3 Standard-Chipsätze nutzt oder kompatibel dazu ist,
oder es einen Treiber gibt, welcher im System einen virtuellen COM-Port bereit stellt,
dann ist es eigentlich ganz einfach und mit Hausmittelchen (ComPort-Komponente bzw. Terminal) zu realisieren.

Was das Ding für ein Protokoll über USB nutzt, hab ich auf die schnelle nicht erkennen können,
und ob man da einfach mit "Standardsachen" z.B. über die SetupAPI auf das USB-Device zugreifen könnte,
aber steht bestimmt alles in der Doku.
https://www.infineon.com/dgdl/Infine...7d0ec9f7974252

Bei speziellen Treibern, mit 'ner zu komplexen API, wird es dann schwieriger.

Hier scheint es eine DLL zu geben (wie Vorgänger erwähnte), wofür du meistens "nur" eine passende Unit mit den DLL-Exports benötigst,
und schon kannst du die Funktionen dieser DLL einfach aufrufen ... je nachdem, wie kompliziert oder pervers diese API dann aufgebaut ist, kann es einfach oder schlimm werden.

Falls es eine C++-Header-File für die DLL gibt, und es nicht extrem viele Funktionen sind, dann wäre es wohl nicht so aufwändig, das in eine Delphi-Unit zu übersetzen.


Es gibt/gab wohl auch schon Projekte, wo jemand das Ding auf einen DruckerPort umgebogen hat
und darüber via DeviceIoControl auf den RAM (Speicher) des Chips zugreift.
https://www-user.tu-chemnitz.de/~heh...LPT/api.en.htm



https://www.edaboard.com/threads/del...fx2-usb.24193/




HID ... lange her und selbst nie wirklich genutzt.
Bissl schade, dass unsere beiden foreneigenen Experten, zu diesem Thema, verstorben sind.

https://github.com/kategray/CyUSB/bl.../src/CyAPI.cpp
https://github.com/kategray/CyUSB/tr...ibrary/cpp/inc
Ich seh da jetzt keine Exports für eine DLL (oder übersehn), falls man es mit einem C++-Compiler zu einer DLL kompilieren würde/könnte,
aber vermutlich kann man den Code davon nach Delphi übersetzen und dann letztendlich via MSDN-Library durchsuchenDeviceIoControl direkt mit dem USB-Gerät reden,
falls das ganze kompatibel zum eigenen Gerät und dessen Firmware ist.

CyAPI.cpp -> CCyFX3Device würde scheinbar die eigentliche API darstellen, deren Funktionen du dann selbst ansprechen würdest (nach Aufbau der Verbindung).
Ein Therapeut entspricht 1024 Gigapeut.

Geändert von himitsu (14. Aug 2024 um 18:29 Uhr)
  Mit Zitat antworten Zitat
Alter Mann

Registriert seit: 15. Nov 2003
Ort: Berlin
948 Beiträge
 
Delphi 10.2 Tokyo Professional
 
#2

AW: Delphi 7, mit USB auf Cypress CY7C68013 FX2 zugreifen

  Alt 14. Aug 2024, 19:10
Noch etwas zum stöbern:

DLL für Cypress CyUSB Treiber erstellen
  Mit Zitat antworten Zitat
max pack

Registriert seit: 28. Okt 2011
4 Beiträge
 
#3

AW: Delphi 7, mit USB auf Cypress CY7C68013 FX2 zugreifen

  Alt 15. Aug 2024, 15:51
Vielen Dank Alter Mann und himitsu für die schnellen Antworten.
Ich habe nach dutzenden von Stunden gefühlt schon das ganze Internet durchsucht nach einer Lösung bzw. wenigstens nach einer neuen Idee, daher kannte ich die hier vorgeschlagenen Seiten schon. Leider hilft mir das bei meinem Problem nicht weiter. Ich bin offen für weitere Lösungsansätze, vielen Dank und Gruß.
  Mit Zitat antworten Zitat
Alter Mann

Registriert seit: 15. Nov 2003
Ort: Berlin
948 Beiträge
 
Delphi 10.2 Tokyo Professional
 
#4

AW: Delphi 7, mit USB auf Cypress CY7C68013 FX2 zugreifen

  Alt 15. Aug 2024, 15:57
Hi,

reden wir hier von so einenm Teil (wie im Anhang)?.
Angehängte Grafiken
Dateityp: jpg EZ-USB FX2LP CY7C68013A.jpg (55,4 KB, 26x aufgerufen)
  Mit Zitat antworten Zitat
Kas Ob.

Registriert seit: 3. Sep 2023
404 Beiträge
 
#5

AW: Delphi 7, mit USB auf Cypress CY7C68013 FX2 zugreifen

  Alt 15. Aug 2024, 17:57
Hi,

My knowledge with such USB devices is very limited as almost non existed, but i can put some thoughts about this subject:

1) Using specific USB API (WinUsb) is way easier than going full low level with DeviceIoControl, so yes stick to https://learn.microsoft.com/en-us/wi...32/api/winusb/

2) I see that you reported successful WinUsb_QueryPipe, yet you did not mention what is the result of WinUsb_ReadPipe, see,.. return value is the most important for any API, in case of failure then you always want to query and report/log the GetLastError, always always always do that .

3) from your post WinUsb_ReadPipe you are using $81 as PipeID, while PipeID is in fact bEndpointAddress, where
Zitat:
Bit 7 indicates the direction of the endpoint: 0 for OUT; 1 for IN.
May be i am wrong here but shouldn't be 0 here ? meaning the PipeID should be $01.

4) The buffer size is very important, many devices are so simple hardware that refuse to handle arbitrary sizes, so after WinUsb_QueryPipe, use the MaximumPacketSize in that Info, try only that size or exact multiple sizes aka n*MaximumPacketSize, no more and no less.

5) To my knowledge to almost always you need to issue a command then read the result, USB it self is protocol, so i think WinUsb_WritePipe should be involved before WinUsb_ReadPipe, but again i might be wrong.

Now to different approach :
I faced something similar with completely different hardware, there was working software, the client needed remote functionality for this USB device which the company was dissolved and gone, so i reversed engineer its protocol and extracted the few needed commands, then build an application to do it.
I will not assume you will/can entertain the full process of reversing/decompiling... , but i can suggest something you can use and at least put you on the right way, Use Api Monitor from here http://www.rohitab.com/apimonitor
or try to search for DDK debugger if you prefer, with API Monitor you can choose the following functions in the screen shot, assuming you have working software with that device
WDK_USB.png

See how that software is communicating with USB device, watch how the API's are being used and deduce your usage, as Api Monitor can and will capture the selected API function and their parameters with their return value, pay extra attention to the buffers sizes , and .....
I can't emphasize enough to check if that working software is using overlapped or not, if it is then you must (have to) use overlapped as this device is asynchronous and might be filling partially, in other words your problem could be simply blocking and waiting, yet, use this monitor for confirmation.

Sorry for the bad English, and good luck !
Kas
  Mit Zitat antworten Zitat
max pack

Registriert seit: 28. Okt 2011
4 Beiträge
 
#6

AW: Delphi 7, mit USB auf Cypress CY7C68013 FX2 zugreifen

  Alt 16. Aug 2024, 16:04
Hallo zusammen,
@Alter Mann: Nein, ich habe ein anderes Teil, kommt von AZ-Delivery (ohne hier Werbung zu machen oder Urheberrechtsverletzungen BlaBla auf den Leim zu gehen, dient nur der Beschreibung). Ist zwar absolut lächerlich, sollte heutzutage aber leider dazu geschrieben werden.

@Kas Ob: Thank you for your response.
1. Thanks, yes, I know the site with the learn.microsoft.
2. Sorry, you're right. Here are the returned values by a recievebuffer-size of 512bytes:
WinUSB Initialisierung OK.
WinUSB Handle basierend auf dem DeviceHandle ist: $00647918
---------------------------------------------------------------------------------------------------------------
WinUsb_GetDescriptor: Beschreibung des USB-Geräts abrufen:
Descriptor Länge: 18
DescriptorType: 1
USB Specification (Version): 2.0
DeviceClass: 255
DeviceSubClass: 255
DeviceProtocol: 255
Max Packet Size: 64
Vendor ID (VID): 0925
Product ID (PID): 3881
Device1: 1
Device2: 0
Manufacturer: 0
Product: 0
SerialNumber: 0
NumConfigurations: 1
---------------------------------------------------------------------------------------------------------------
WinUsb_QueryPipe: Infos zu den Pipes abfragen:
Pipe: 0 Endpoint: $0001 TransferType=Bulk Maximale Paketlänge: 512 bytes Interval: 0
Pipe: 1 Endpoint: $0081 TransferType=Bulk Maximale Paketlänge: 512 bytes Interval: 0
Pipe: 2 Endpoint: $0002 TransferType=Bulk Maximale Paketlänge: 512 bytes Interval: 0
Pipe: 3 Endpoint: $0004 TransferType=Bulk Maximale Paketlänge: 512 bytes Interval: 0
Pipe: 4 Endpoint: $0086 TransferType=Bulk Maximale Paketlänge: 512 bytes Interval: 0
Pipe: 5 Endpoint: $0088 TransferType=Bulk Maximale Paketlänge: 512 bytes Interval: 0
---------------------------------------------------------------------------------------------------------------
WinUsb_ReadPipe: Daten abrufen aus Endpoint
WinUsb_ReadPipe erfolgreich
Bytes wurden emfangen: 0

48 F1 19 00 00 00 00 00 30 5C F3 00 04 00 00 00
00 84 62 00 FF FF FF FF 99 0F 01 2B 01 00 00 00
00 00 00 00 36 00 00 00 00 00 60 00 00 00 00 00
00 00 15 00 63 00 00 50 AF 74 BD 77 00 00 00 00
5E C6 B3 77 63 01 00 50 00 84 01 00 00 00 00 00
E0 83 62 00 08 84 62 00 00 00 60 00 A4 F1 19 00
C4 5F BD 77 15 00 04 11 9B 5F BD 77 0B 6F C6 7D
00 00 60 00 00 00 00 00 00 00 00 40 F4 0A 00 00
50 00 00 00 0A 00 00 00 00 84 62 00 63 01 00 50
72 B8 83 00 0A 00 00 00 50 84 62 00 00 84 62 00
00 84 62 00 64 F2 19 00 30 F3 B6 77 17 DA 1F 0A
FE FF FF FF EC F1 19 00 DD 0A B8 77 00 00 00 00
04 0B B8 77 08 84 62 00 00 00 60 00 00 00 00 00
36 00 00 00 9F 6D C6 7D 36 00 00 00 40 00 00 00
00 00 60 00 71 00 10 00 00 00 00 00 04 00 00 00
18 00 00 00 C9 00 00 00 01 00 00 00 00 00 60 00
00 00 60 00 00 00 00 00 00 00 60 00 18 F2 19 00
AF 74 BD 77 01 00 00 00 00 00 60 00 00 00 00 00
01 00 00 00 00 00 60 00 00 00 00 00 00 00 60 00
00 00 00 00 74 F2 19 00 AA 67 BD 77 58 02 60 00
7F 67 BD 77 DB 6C C6 7D 00 00 60 00 04 00 00 00
00 00 00 00 C4 F2 19 00 32 B3 7E 75 70 00 00 00
68 F2 19 00 00 00 00 00 63 00 00 50 00 00 60 00
00 84 62 00 01 00 00 00 00 84 62 00 70 87 62 01
20 F2 19 00 0F 00 00 00 A0 F3 19 00 30 F3 B6 77
BF CB 1F 0A FE FF FF FF B0 F3 19 00 46 F8 B3 77
08 84 62 00 1F 6D C6 7D 00 84 62 00 00 00 60 00
00 00 00 00 F0 F2 19 00 CB 6D DE 76 00 00 00 00
88 45 16 77 70 87 62 00 99 0F 01 2B D0 5A F3 00
00 00 00 00 58 76 01 00 62 00 00 40 00 00 00 00
F4 0A 00 00 99 0F 2B FF FF FF FF FF F4 0A 00 00
01 2B 01 00 00 00 00 00 00 00 00 00 F5 AD 7E 75
3. Yes, right, my mistake. This was just from my quick'n dirty testing. I tested several values, without any success.
4. I tested several sizes of buffer, withot success.
5. I tested this. The documentation from Sigrok says, that the device needs 2 bytes on endpoint 1: 0x01 (or 0xd5 for newer versions) and the second byte for the samplerate. Again no success.
My next work could be the test with the ApiMonitor, as you suggested.


Um uns gegenseitig nicht weiter unsere Zeit zu stehen - bitte nicht falsch verstehen(!) - sollten wir nicht weitere Links aufführen mit: Guck mal hier oder da und kennst Du das schon... Das ist sicherlich gut gemeint, aber nicht zielführend.
Ich hatte gehofft, dass schon jemand damit konkrete Erfahrungen hat und sagen kann: Hier ist ein Codeschnippsel, oder da ist ein Schreibfehler in der Doku und muss heißen Rumpelstielzchen(123) statt Schneewittchen(432), oder eine andere Lösung.
Ich muss mich wohl damit abfinden, dass ich mein Vorhaben so in dieser Zusammensetzung nicht hin bekommen werde.
Das ist zwar schade, ist aber auch eine Art Lösung und eine Erkenntnis.
Aber vielleicht meldet sich ja noch ein Wissender.


Trotzdem nochmals vielen Dank an die tüchtigen Teilnehmer und allen ein schönes Wochenende.
  Mit Zitat antworten Zitat
Alter Mann

Registriert seit: 15. Nov 2003
Ort: Berlin
948 Beiträge
 
Delphi 10.2 Tokyo Professional
 
#7

AW: Delphi 7, mit USB auf Cypress CY7C68013 FX2 zugreifen

  Alt 17. Aug 2024, 14:10
So, so. Den LA habe ich auch, jedoch ekennt Windows den nicht.
Zitat:
Vendor ID (VID): 0925
Product ID (PID): 3881
Dafür ist der Saleae Treiber erforderlich, oder irre ich mich?
  Mit Zitat antworten Zitat
Antwort Antwort

 
Themen-Optionen Thema durchsuchen
Thema durchsuchen:

Erweiterte Suche
Ansicht

Forumregeln

Es ist dir nicht erlaubt, neue Themen zu verfassen.
Es ist dir nicht erlaubt, auf Beiträge zu antworten.
Es ist dir nicht erlaubt, Anhänge hochzuladen.
Es ist dir nicht erlaubt, deine Beiträge zu bearbeiten.

BB-Code ist an.
Smileys sind an.
[IMG] Code ist an.
HTML-Code ist aus.
Trackbacks are an
Pingbacks are an
Refbacks are aus

Gehe zu:

Impressum · AGB · Datenschutz · Nach oben
Alle Zeitangaben in WEZ +1. Es ist jetzt 18:40 Uhr.
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
LinkBacks Enabled by vBSEO © 2011, Crawlability, Inc.
Delphi-PRAXiS (c) 2002 - 2023 by Daniel R. Wolf, 2024-2025 by Thomas Breitkreuz