-
Notifications
You must be signed in to change notification settings - Fork 988
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
USBTMC example not working on SAMD21/SAMD51 #558
Comments
I tried examples/device/hid_generic_inout and had no issues with the compile and uf2 programming. I was able to run the example without any issues. |
I did notice this in DMESG on the raspberry pi: [ 2.214996] usb 1-1.4: new full-speed USB device number 4 using xhci_hcd |
I tried using my itsybitsy_m4 (SAMD51) and it has the exact same issue. |
have you managed to get the stack log with PS: just realize itsybitsy bsp doesn't have board_uart_read/board_uart_write implemented just yet, you need to implement that first before getting the log. I will add it later when I have time. |
I just tested usbtmc example (master branch) on a STM32F0, and it's enumerating and responding to "*IDN?" on Windows 10. As far as I know, I'm the only person who has used the class and I've only used it on a ST MCU. I may order a SAMD21 (I've never used one before), and see if I can figure anything out if this issue doesn't get debugged soon. The only "different" thing in the UBTMC class is that it uses an interrupt endpoint by default. You could try disabling it? Set |
Thank you for the suggestion. Here's my code:
Here is the response (it is identical for both visa and pyvisa):
I tried on Raspberry Pi python (using pyvisa and pyvisa-py backend)
Here's the response:
I ordered a STM32FC411CE "Black Pill" and it should be arriving early next week (got a 3pack on a Black Friday sale). |
I've been able to reproduce the symptoms on a NXP LPCXpresso54114 board. I'll attempt to debug the problem, but I'm not at all familiar with NXP MCUs. |
I tried the example on a STM32F411CE blackpill board and had no issues. Runs as expected. I have obtained a j-link debugger to see if I can see differences between the STM32 board and the SAMD21 board with the code execution. |
I believe the problem is in the usb_descriptors.c file. When I compare the example/device/cdc_msc/src/usb_descriptors.c file, there is a comment about SAMG: #elif CFG_TUSB_MCU == OPT_MCU_SAMG |
SAMG and SAMD aren't the same, they are using different usb controller. |
I have my Segger JLINK Edu setup and have 2 microcontrollers: (1) Adafruit Trinket M0 (ATSAMD21E18) and (2) STM32 Blackpill (STM32F411CE). STM32 board is working. In "main.c" I tried commenting-out the "usbtmc_app_task_iter()" subroutine and STM32 was just fine (the app did not work but the operating system was fine with the USBTMC device attach). This makes me believe the problem is with either "tusb_init()" or "tud_task()". Here is my make command for the SAMD21: I am running "JLinkRTTLogger" but I get an empty RTT logfile. This is my first time using this tool, and I read a couple of tutorials. Am I supposed to start the logger and then reset the part to get the logfile? |
rtt should print some log out, please try with JLinkRTTViewer, I think you have to select the MCU and it could detect the clock speed, the swd clock around 1-4Mhz is pretty safe. Also you need to clean the project first, since |
Thanks for the feedback. I am cleaning the build directory before each new make command. When I try a make with the "LOGGER=rtt", program the part and reboot I am not seeing the device enumerate properly. Is this expected? This is what I see when I am using the logger: Perhaps the logger code is too large. Also I am seeing that I am not overwriting the bootloader when I flash with tinyusb. It appears to be protected by the BOOTPROT fuse. I was able to clear the BOOTPROT fuse by writing it to 0xFF, but that did not help me to flash the logger code and see proper enumeration. Sorry for all the questions, I'm making slow progress. |
maybe you could drop the I will try to pull out an SAMD21 board to test out with RTT log tomorrow or so if I could find time. |
Thanks. I tried the "LOGGER=rtt" make arguement with the STM32F411CE blackpill board and I get the same results as the SAMD21. [ 1390.525659] usb 1-1.3: new full-speed USB device number 17 using xhci_hcd |
I was able to see the RTT log using JLinkRTTViewer with the Attached are the 2 log files from JLinkRTTViewer: |
I needed to remove the "00>" text from the tinyusb_usbtmc_example_atsamd21e18_2.log file so that it can be compared with the other log file. Here is the updated file. |
The highlighted difference is the host assigning a different USB device address for each MCU. I don't think it's a significant difference. The "interesting" part is the One conjecture is that this due to the Could you try changing the packet length to 8 and check if it the device works?
If this works, probably we just change it, and assume that nobody is as crazy as I am to choose a weird (We also should have a condition that sets the bulk endpoints to 256 bytes when in full-speed mode) ADDED LATER: Yep, the samd driver only supports 8, 16, 32, 64, etc. lengths, so I expect this change will fix the issues. |
You are right, any number from 0 to 64 is complaint to the specs. However, many MCUs like SAMD will only accept 8,16,32,64 where endpoint size is configured in bit-field register.
No problem, I am glad that we could help. Would you submitting the PT that include |
@hathach, do I create a branch with the changes and then do a pull-request? I setup my ssh key with my github account and made a tinyusb clone using it. I was going to push the changes to a new branch but I don't have permission to do that. |
@charkster, I think "PT" is a typo. He means "PR". What you need to do is "fork" the repository, and then create a new branch in your fork and push the branch to your fork of the repository. Once you do that, the GitHub website will let you create a new pull request between tinyusb/master and your branch in the forked repository. |
Setup
Setup 1:
PC OS: Windows 10
Board: Seeeduino Xiao (samd21),
Firmware: examples/device/usbtmc
Setup 2:
PC OS: Raspberry Pi OS (using pyvisa 1.11.1, pyvisa-py 0.4.1)
Board: Seeeduino Xiao (samd21),
Firmware: examples/device/usbtmc
Describe the bug
On Windows 10 pyvisa (using NI VISA backend) will not report the device.
On Raspberry Pi pyvisa reports the device, but the resource manager is unable to connect.
To reproduce
Steps to reproduce the behavior:
Screenshots
Log
Working to get log file. Have not been successful yet.
The text was updated successfully, but these errors were encountered: