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

D5035-01 XTAL SuperCAN Windows7 USB Driver? #12

Closed
MikeEmbedded opened this issue Dec 28, 2022 · 25 comments
Closed

D5035-01 XTAL SuperCAN Windows7 USB Driver? #12

MikeEmbedded opened this issue Dec 28, 2022 · 25 comments

Comments

@MikeEmbedded
Copy link

Hi,

I successfully managed to compile SuperDFU and SuperCAN for CANBed M4 bought from https://docs.longan-labs.cc/1030013/

I flashed SuperDFU by J-Link and after that I used dfu-util to upload SuperCAN.dfu.

The problem is that I couldn't find USB drivers for SuperDFU and for D5035-01 XTAL SuperCAN USB devices.

I used zadig-2.7.exe to install drivers for SuperDFU and it works because I can upload supercan.dfu to the Board using dfu-util.

After that my Board looks like D5035-01 XTAL SuperCAN (b2a90602) in Device Manager of Windows and has exclamation sign that means that there is a problem with driver for it.

I used zadig-2.7.exe to solve this problem but I think it is wrong.

I compiled supercan_app64.exe(demo App from your Windows folder) and it couldn't find any SuperCAN device.

supercan_app64.exe tries to find device by GUID {0xf4ef82e0, 0xdc07, 0x4f21, 0x86, 0x60, 0xae, 0x50, 0xcb, 0x31, 0x49, 0xc9} but it is different from a GUID of my Board in Device Manager.

I tried to change GUID in supercan_app64.exe to that one from GUID of my Board in Device Manager with no result.

So I think the problem is in drivers for D5035-01 XTAL SuperCAN.

Can you help me to find these drivers please?

@jgressmann
Copy link
Owner

jgressmann commented Dec 28, 2022 via email

@MikeEmbedded
Copy link
Author

@jgressmann Thank you for your answer.

I tried to run app with --single option and again it didn't find SuperCAN device.

I am new with USB devices.

I googled and realized that from Device Manager I see GUID of the Device Class but for demo app I need GUID of the Device Interface.

I found a code which gives Device Interface GUID but my Wireless Keyboard has the same Device Interface GUID also.

I changed Device Interface GUID and demo app finds two SuperCAN devices!!!

One of it is SuperCAN and another one is Keyboard(((

That's why I think I have wrong .inf file of driver for SuperCAN USB device.

Can you tell how Device Manager should show SuperCAN USB device in it's tree?

@jgressmann
Copy link
Owner

jgressmann commented Dec 29, 2022

Should look like this in device manager (redacted serial):

image

and like this from the app:
image

From what I know about USB on Windows, the device should work with Win7. You could try with the release installer. That way you could be reasonably sure the Windows parts work as expected. I am assuming you customized the firmware for the board?

@MikeEmbedded
Copy link
Author

Yes, I customized the firmware for ATSAME51G19A and flashed it ATSAME51G19A but compiled it for ATSAME51J19A.

I run supercan_inst.exe and installed drivers finally. After that I have next devices in Device Manager:
1

Could this problem be because I use ATSAME51G19A?

@jgressmann
Copy link
Owner

Yes, I customized the firmware for ATSAME51G19A and flashed it ATSAME51G19A but compiled it for ATSAME51J19A.

Should be fine.

Could this problem be because I use ATSAME51G19A?

I don't believe so. The G means you have got a 48 pin chip, same RAM, ROM as the J variant.
By the looks of it Windows doesn't recognize the device properly (or fails to install the drivers). You will need to use Zadig to install WinUSB drivers for the CAN ch0 interface so that the exclamation mark goes away.

Once there the demo app should pick up the device. If you have the option you could also try your device with a Windows 10 setup. There, you wouldn't need to use Zadig at all, Windows will simply recognize the device.

@MikeEmbedded
Copy link
Author

@jgressmann thank you very much for your help.

First of all I would like to congratulate with Happy New Year!!! Hope next year will be better!!!

About SuperCAN. I used Zadig app in Windows 7 and I've got next results:
1

I reinstalled supercan_inst.exe with developer support checkbox and run supercan_app64.exe from C:\Program Files\SuperCAN\bin with no result((((

2

I also tried to install supercan_inst.exe at Windows 10 and it doesn't recognized my device((((

@jgressmann
Copy link
Owner

@jgressmann thank you very much for your help.

You are quite welcome.

First of all I would like to congratulate with Happy New Year!!! Hope next year will be better!!!

Happy New Year to you too. I wholeheartedly agree with your assessment of the year.

About SuperCAN. I used Zadig app in Windows 7 and I've got next results: 1

I reinstalled supercan_inst.exe with developer support checkbox and run supercan_app64.exe from C:\Program Files\SuperCAN\bin with no result((((

2

I also tried to install supercan_inst.exe at Windows 10 and it doesn't recognized my device((((

This should work out of the box. Most likely the error is on the firmware side of things, then. In the USB descriptor parts would be my guess. You could compare your code to the board code for Adafruit's Feather M4 CAN. That board is confirmed to work.

@MikeEmbedded
Copy link
Author

MikeEmbedded commented Jan 2, 2023

I changed at Windows Registry Device Interface GUID to {f4ef82e0-dc07-4f21-8660-ae50cb3149c9} and supercan_app found device.

But CAN++ still doesn't see my Board. Should CAN++ see SuperCAN board out of the box?

@jgressmann
Copy link
Owner

I don't understand why you'd have to change the GUID manually. The GUID should be included in the MS OS 2.0 descriptor set that the device hands out.

Regarding CAN++, yep, that should work. Does the demo app in --single mode pick up your device?

image

@MikeEmbedded
Copy link
Author

@jgressmann I could install and run my Board at Windows 10 finally!!!

CAN++ see my Board. My Board has one CAN channel only.

Can you please tell me if I can use this channel for sniffer in CAN++? I am new with CAN++ app.

Sorry for my stupid questions and thank you for your help!!!

@jgressmann
Copy link
Owner

Congrats on getting the board to work. Would you mind sharing your work? You could create a pull request when you are satisfied with your code.

I assume by sniff you mean read what is on the bus? Then yes, absolutely.

@MikeEmbedded
Copy link
Author

MikeEmbedded commented Jan 4, 2023

@jgressmann sorry for the long delay. I was experimenting with USB device connection.

I found next things on connecting my Board to USB:

  1. Windows7 USB2.0 - connects, detected normally but CAN++ doesn't see Board.
  2. Windows10 USB2.0 - Board detected as Unknown Device(device enumeration failure).
  3. Windows10 USB3.0 - connects, detected normally and CAN++ see Board.

I connected my Board(connected to Win10 USB3.0) to a CAN bus then run supercan_app64 --nbitrate 500000 --log ALL and all messages from CAN bus started listing in CLI window. It means that my Board works well and with "--log ALL" it works like a sniffer(what I need actually).

I couldn't configure CAN++ as a sniffer, may be you can help with it?

But anyway, I can write by myself GUI that will be a sniffer for me using source code of supercan_app(again thank you very much).

So, all these things say that problem is that my Board doesn't work with USB2.0. Can you help me with it?

About sharing the source code changing. Of course I will share it with you, no problem.

I made customization of BOARD=d5035_01 to work on my Board but it should be right to do a new Board configuration but that is difficult for me and I don't know how to do it. So I can make a .zip file of supercan project and give it to you and you will make a new board configuration by yourselves. If it is OK for you then no problem.

@jgressmann
Copy link
Owner

Not sure what is going on with your setup. I see no issues with either USB3.0 or 2.0 on Windows / Linux.

Regarding CAN++, I am uncertain what sniffing parts are missing for you. You could contact the program's author to get further help.

Thank you for considering sharing your code. A zip file is fine.

@MikeEmbedded
Copy link
Author

Hi @jgressmann

Please find .zip file at https://drive.google.com/file/d/1V9ZFJmI0q5OJNOCW9VIg8ddgM8b26-Ue/view?usp=share_link

Please let me know if you will have any question.

jgressmann added a commit to jgressmann/tinyusb that referenced this issue Jan 13, 2023
This work is based on the work of MikeEmbedded, c.f.

jgressmann/supercan#12
@jgressmann
Copy link
Owner

I have added initial support for the board. Let me know if it works out for you:

Link to latest firmware

@MikeEmbedded
Copy link
Author

Hi @jgressmann.

I downloaded and tested supercan-standalone, superdfu and supercan-app, all work ok

I try to resolve USB2.0 problem. I will write here as soon as fix this problem.

By the way, does supercan uses latest version of tinyusb?

@jgressmann
Copy link
Owner

That's great news. Please keep me prized of your findings. I'd love to know why this isn't working for you.

Regarding latest and greatest, no. To support some of the smaller MCUs, I had to modify the stack quite a bit. Unfortunately, those changes are not in line with goals of the original project.

@TDahlmann
Copy link

Hi @MikeEmbedded,

developer of CAN++ here. Could you see CAN traffic with CAN++ with your board now? If not may be I can help. There is a small help under "Help" => "Help Topics" (work in progress).

@MikeEmbedded
Copy link
Author

MikeEmbedded commented Jan 19, 2023

Hi @TDahlmann.

Thank you helping me.

I am trying now to solve Win10 USB2.0 issue. My Longan CanBED M4 board works with Win10 USB3.0 at the moment and CAN++ can see it. Longan CanBED M4 board also works with Win7 USB2.0 but CAN++ can't see my board.

I had problem with CAN++ because I have only one CAN channel and it is used by CAN++ as Diagnostic channel. I couldn't configure CAN++ to use that single CAN channel to see CAN traffic.

May be I will open issue at CAN++ repository when my USB2.0 will be solved.

Thank you!!!

@TDahlmann
Copy link

Hi @MikeEmbedded,

one channel should not be the problem. Assignment of channel for diagnostics is no problem. CAN++ just shows on which channel Diagnostics requests would be sent if for instance fault memory is read.

Did you configure the baudrate under "Settings" => "Channel Configuration"?

Yes, good idea to open an issue on CAN++ repo for your topic.

@MikeEmbedded
Copy link
Author

Hi @jgressmann

I am still trying to solve my USB problem.

Today I tried to test cdc_dual_ports example on my CanMBED 4 board.

I compiled it with BOARD=d5035_01 HWREV=3 and it works as expected on Win7 USB2.0.

So please can you tell me what code modifications did you do for tinyUSB stack?

@jgressmann
Copy link
Owner

The modification target reductions in RAM / ROM size and are not related to OS USB descriptor handling.

I would think the reason the CDC example works is because that device class has been supported natively by Windows for a while now.

The trick the firmware does to make the device work on Win10 is to hand out MS OS 2.0 compatible descriptors (see here). For Windows prior to version 8, the OS descriptor looks different and is retrieved differently. There is no support for Win7 in the firmware. You could add said support yourself.

Given that your device works on Win10 on USB3, have you considered that there might be a hardware issue with your USB2 hub? To get to the bottom of this I humbly suggest you purchase a supported board such as Adafruit's Feather M4 CAN and work your way back to the Longan one. The Feather M4 board is confirmed to work on Win10 on USB3 and USB2. The image below has been taken on Win10 connected to a USB2 hub.

image

@MikeEmbedded
Copy link
Author

MikeEmbedded commented Jan 30, 2023

Hi @jgressmann .

Adafruit's Feather M4 CAN is out of stock at the moment((((.

I tried my board at two other PCs and it works with one PC at USB2.0 and doesn't work with another one.

So I think this issue can be closed. I will write if I will find anything about this problem.

Thank you!!!

@skiphansen
Copy link

@MikeEmbedded FYI They are back in stocks at the moment. I bought two to try supercan.

@MikeEmbedded
Copy link
Author

@skiphansen thank you for these news but I am in process of porting TinyUSB at STM32G0B1. Porting Supercan at STM32G0B1 will be next step

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

4 participants