#tinyusb

1 messages · Page 2 of 1

fallow birchBOT
#

On a different note, the code coverage for the msc and net class fuzzers is not fantastic and i might be missing something in my fuzzing stubs. I'm going to take a closer look over the next couple of days, but if you've got time to take a quick look at the fuzz harnesses/callbacks that would be fantastic.

https://storage.googleapis.com/oss-fuzz-coverage/tinyusb/reports/20230119/linux/src/tinyusb/src/class/report.html

fallow birchBOT
#

Describe the PR
Currently the AFL fuzzing engine makes the assumption that it can run a library in multiple threads without any shared state. To make this assumption consistent with tinyusb we need to make static globals thread local when fuzzing.

Additional context
Discussed here:
https://github.com/hathach/tinyusb/issues/1715#issuecomment-1396436517
Actual issue here (see stability)
https://oss-fuzz.com/fuzzer-stats?project=tinyusb&fuzzer=afl&job=afl_asan_tinyusb&group_b...

fallow birchBOT
fallow birchBOT
fallow birchBOT
fallow birchBOT
fallow birchBOT
fallow birchBOT
fallow birchBOT
#

When tools/top.mk finds it is running on Windows, it expects SHELL set to cmd.exe.
Some Windows development environments invoke a mingw version of gnu make with SHELL set to /bin/sh or /bin/bash (either explicitly or by default), in which case tinyUSB make fails when a $(shell...) command feeds DOS syntax to sh. We can't just use sh, as many Windows environments won't have unix utilities like realpath (used by this makefile for sh shell commands).

This fix forces SHELL=cmd.exe on Windows ...

fallow birchBOT
fallow birchBOT
#

I've addressed the review comments and updated the PR but unfortunately it looks like the SOF interrupt has to be constantly enabled. I cache the time of the previous SOF event and compute delta modulo 1000, but this will fail after several seconds as it appears there is enough clock drift to push the software blanking period away from the critical period.

We have no other way of keeping a stable count of where we are in a frame without logging every interrupt so whenever a bulk IN endpoin...

fallow birchBOT
fallow birchBOT
fallow birchBOT
#

ah thanks for the tip, currently I have an issue with IAR assembler. Since freeRTOS for IAR have asm file, however, IAR assembler does seems to have limited support for preprocessor. I cannot handle the tusb_option.h include especially the TU_CHECK_MCU(). Anyway, I will try to find an walkaround to for FreeRTOSConfig.h without the need to include tusb_config.h

fallow birchBOT
#

Describe the PR
GPIOE was turned on twice, changed to missing GPIOF.
GPIOI is not present on all boards notably STM32H723
so clock in turned on only if present.

Add support for nucleo-h723zg

Mostly copy of stm32h743nucleo.
Linker script generated by STM32CureIDE.

Since this device has only one HS USB, board.h contains few defines that map on
board HS USB to FS because there is no ULPI chip mounted on Nucleo board.

Additional context

fallow birchBOT
fallow birchBOT
#

Operating System

RaspberryPi OS

Board

RP2040

Firmware

examples/host/cdc_msc_hid

What happened ?

I am trying to use a Pico as USB Host to and Arudino Due for a USB Serial Connection. When data is sent, an assertion fails. While the below says the assertion fails on line 484, it is actually line 481. The difference is due to some additional logging statements added by me.

How to reproduce ?

Build examples/host/cdc_msc_hid on pico and load onto pico.
Connect usb c...

fallow birchBOT
#

Describe the PR
Adds a seed corpus for the fuzzer based on real USB packets captured using wireshark.

Additional context
By default, a fuzzer will try to randomly search for inputs that increase code coverage. In some cases this can take a really long time for the fuzzer to "learn" the structure of a protocol. One approach to mitigate this problem is to give the fuzzer a good starting point, with ...

fallow birchBOT
fallow birchBOT
fallow birchBOT
#

@HiFiPhile IAR Assembler preprocessor is rather limited and does not seems to support variadic macro. This becomes an issue with freertos example where portasm.s include FreeRTOSConfig.h which in turn include "tusb_option.h". I have send an support request to IAR. Though is there any chance that you an walkaround (maybe I miss an IAR compiler/assembler option).

#define TU_ARGS_NUM(...)   _TU_NARG(_0, ##__VA_ARGS__, _RSEQ_N())
--------------------^
"/home/hathach/code/tinyusb/src/c...
#

I got this "working" by adding the following to tu_edpt_bind_driver
ep2drv[tu_edpt_number(0x83)][tu_edpt_dir(0x83)] = driver_id;
ep2drv[tu_edpt_number(0x04)][tu_edpt_dir(0x04)] = driver_id;

Obviously this isn't the correct fix, but at least gives me something to work with for now.

I can see that endpoint addresses 04 and 83 aren't being found by this function, even though they are returned during the parsing of the configuration descriptor.
TUSB_DESC_ENDPOINT = 5, tu_desc_typ...

fallow birchBOT
#

Describe the PR
This PR add support for IAR build with self-hosted ci hosted by @HiFiPhile. Initial port includes stm32 f0, f1, f4, f7. It is almost complete except for freeRTOS example where portasm.c (in the freeRTOS kernel) include FreeRTOSCOnfig.h which in turn include the tusb_option.h. Initially I thought the IAR Assembler cannot handle complicated macros, however, It look more like the issue is including C header file inside an .s file.

https://github.com/FreeRTOS/FreeRTOS-Kern...

#

I have only used the assembler for basic things such as copy vector table to ram.

It seems only thing needed by port.asm is configPRIO_BITS, is it possible to wrap other things by #ifndef _ _IAR_SYSTEMS_ASM_ _ ?

@HiFiPhile let me move the discussion here to make it easier to follow. Indeed, I just figured it out, that including C header in the .s file is the root cause (after trying to conform with IAR Assembler). configPRIO_BITS is unfortunately defined within mcu header such...

fallow birchBOT
fallow birchBOT
fallow birchBOT
#

Thanks! Dumb question though: We all hate comment syntax in make and shell that essentially prohibits space before comment # mark. But, I put the following on one line so that it would be easy to see when someone greps for CMDEXE to find out it's exact meaning. So, sorry for the question, why did you break it into multiple lines?
Thanks again for your great work!
Best Regards, Dave
CMDEXE := 1# makefile shell commands should use syntax for DOS CMD, not unix sh

fallow birchBOT
fallow birchBOT
#
[hathach/tinyusb] New branch created: fix\-host\-cdc\-without\-iad
fallow birchBOT
fallow birchBOT
fallow birchBOT
#
MWP

Operating System

Others

Board

STM32H7 Custom

Firmware

STM32H7 using TinyUSB github master pulled on the 2022-05-24.
FreeRTOS 202210.00 .
Main use is two CDC ports.

What happened ?

I'm having occasional random problems with tu_edpt_claim() stalling due to the passed mutex never being unlocked.
tu_edpt_claim() is being called up the chain from a tud_cdc_n_write_flush() in a FreeRTOS static task with low priority.
tud_task() is run from a task with the highest priorit...

rose wedge
#

Is there a list showing which esp-idf version works with which tinyusb version

fallow birchBOT
fallow birchBOT
#
MWP

closed firmware is not reproducible and therefore not trouble-shootable. If you think the issue is caused by the mutex, please try to provide an simplest example that could reproduce the issue.

This shouldn't be closed yet. I can troubleshoot it with some help.

At some point in TinyUSB, the mutex is not being released, so on the next attempt to lock it, the lock function never returns as it's called with no-timeout (forever).

There are two problems here:
1 - the mutex is not relea...

fallow birchBOT
fallow birchBOT
#
[hathach/tinyusb] New branch created: reduce\-selfed\-host\-iar
fallow birchBOT
fallow birchBOT
#

Didn't know it took such long time. Is it compile time or clone sdk ?

Checkout sumodule take about 30s or so, each build takes 2 minutes for each matrix. Actually, I think the issue is due to the matrix. Matrix scale well with a farm of PC. In our case it hurt the self-hosted since it run one after another on 1 instance. Let me try to bundle several family in 1 run, it would possible reduce the time to run

fallow birchBOT
fallow birchBOT
fallow birchBOT
#

Describe the PR
This PR adds support for DshanMCU Pitaya Lite and Blue Pill boards with MM32F3273 cpu.

Additional context
I have experimented with tinyusb on:

  • DshanMCU Pitaya Lite with MM32F3273G8P
  • WeAct Blue Pill boards with the STM32F103 replaced by a MM32F3273G6P

tinyusb works, but care has to be taken to choose the correct SYSCLK_FREQ.

For the MM32F3273 with a 12 MHz crystal, in ``tinyusb/hw/mcu/mindmotion/mm32sd...

fallow birchBOT
#

Operating System

Others

Board

RP2040-Zero

Firmware

Minimal example code which demonstrates my issue:

#include 
#include "pico/stdlib.h"
#include "tusb.h"
#include "bsp/board.h"
void tuh_hid_mount_cb(uint8_t dev_addr, uint8_t instance, uint8_t const* desc_report, uint16_t desc_len) {
    tuh_hid_receive_report(dev_addr, instance);
}
void tuh_hid_umount_cb(uint8_t dev_addr, uint8_t instance) {
}
void tuh_hid_report_received_cb(uint8_t dev_addr, uint8_t instanc...
fallow birchBOT
#
[hathach/tinyusb] New branch created: reapply\-uint16\-len\-tud\_hid\_report\_complete\_cb
fallow birchBOT
#

Well, it's not a solution at all, but if I change the main loop in my test to be:

    for(;;) {
        tuh_task();
        sleep_ms(10);
    }

It appears to "work" without CFG_TUSB_DEBUG being set to 2 or higher... I haven't verified the actual data yet, but it looks vaguely how I'd expect it to.

This was after determining that the log line which seemed to affect the timing enough for things to work was in hidh_xfer_cb() (in class/hid/hid_host.c); specifically:
...

fallow birchBOT
#

Describe the PR
My fix in dhcpserver.c for some DHCP clients (#1712) accidentally introduced a potential DoS vulnerability: In case a DHCP-packet WITHOUT DHCP_MESSAGETYPE was received, the code jumped out of the function without freeing the pbuf as it is required. When enough such messages are received, not pbufs are available anymore to handle traffic and the system might not be able to receive any more packets.
This PR fixes the problem by properly free()ing the pbuf in case no `DHC...

fallow birchBOT
#

GCC deals with it inline, so it is a bit better (smaller in debug mode, but slightly larger in release mode)

The intention here was to save RAM (8 bytes vs 64), however I do agree that perhaps it is undesirable in general to have much of any increase in code size since this feature is something most be clearly don't need (their endpoint use is largely static)

I therefore suggest we #ifdef this new code

fallow birchBOT
#
[hathach/tinyusb] New branch created: rp2040\-build\-fixes
fallow birchBOT
fallow birchBOT
fallow birchBOT
#
[hathach/tinyusb] New branch created: add\-tud\_cdc\_write\_auto\_flush\_level
fallow birchBOT
#

Describe the PR
Defined tuh_hid_send_report using ep_out defined in hidh_interface_t structure.

Additional context
I assume tuh_hid_send_report was originally not defined because hidh_open was incomplete. I don't see any reason why it shouldn't be defined now, so I took a stab at it. I tested it on an RP2040 by sending vibration to a Dualshock 4 HID controller on its OUT endpoint, 3.

fallow birchBOT
fallow birchBOT
fallow birchBOT
#

I don't understand your point. This is bug/typo and as mentioned, it should crash previously in my opinion but it doesn't (pure luck). The code speaks for itself, what else I should put the comment for ?

I use tinyusb and most of the changes that I see do not have consequences for usability.

Then don't upgrade if you have no need for those changes.

fallow birchBOT
#
[hathach/tinyusb] New branch created: release\-0\.15\.0
fallow birchBOT
#

Operating System

Linux

Board

n/a

Firmware

examples/device/cdc_msc

What happened ?

Compilation under sdcc (4.0 and 4.2) fails on the assert at line 414 of cdc.h which checks the size of cdc_line_control_state_t. The exact layout of bitfields is apparently implementation-defined and sdcc makes a different choice than gcc in this case. See the SDCC discussion for more info. So this seems to be a kind of C standard conformance ...

fallow birchBOT
#

The open-source SDCC compiler has many limitations, but I have managed, after considerable hacking, to compile TinyUSB with it. This is one issue that I think is legitimately universal: compiler-specific assumptions about bitfield alignment which are implementation-defined per the Standard. Please see the discussion with the SDCC maintainers.

Describe the PR
This PR tweaks some reserved bitfields so the assumptions made elsewhere in the c...

#

Operating System

Linux

Board

mimxrt1010_evk

Firmware

As far as I can see, everything is broken.

examples/device/msc_dual_lun, as an example is definitely broken.

What happened ?

commit 19768936ae6379b4c86947f70ab5cf2c0f8ed8f4 completely breaks the USB on the mimxrt1010. It appears that it is a problem in the SDK that was updated. Validating that now.

How to reproduce ?

# git checkout 19768936ae6379b4c86947f70ab5cf2c0f8ed8f4
# git submodule update hw/...
fallow birchBOT
fallow birchBOT
#

Upon further investigation, it appears that the SDK broke enabling the DCACHE on the 1011. Not sure if that was intentional, but if you apply this diff, everything works again:

diff --git a/devices/MIMXRT1011/system_MIMXRT1011.c b/devices/MIMXRT1011/system_MIMXRT1011.c
index 3db75178..5adf5339 100644
--- a/devices/MIMXRT1011/system_MIMXRT1011.c
+++ b/devices/MIMXRT1011/system_MIMXRT1011.c
@@ -116,6 +116,11 @@ void SystemInit (void) {
         SCB_EnableICache();
     }
 #endif...
fallow birchBOT
fallow birchBOT
#

Operating System

Linux

Board

Pico

Firmware

examples/hosts/cdc_msc_hid modified to receive 512 + 1 bytes. (originally receives 64 + 1 bytes)

What happened ?

This is not a bug in tiny usb, but rather the Arduino Due. It reports as a Full Speed device, but reports a max packet size of 512. It also sends with a 512 byte packet size. The following patch allows tinyusb to communicate with the due in host mode. It modifies the max packet size from the descriptor from 512 bytes...

fallow birchBOT
#

Operating System

MacOS

Board

Nucleo F413ZH

Firmware

examples/audio_test

What happened ?

I added tinyusb to my CubeIDE project (which worked mostly flawlessly). Then I tried some of the examples. Both audio examples refused to work, while cdc_dual_ports and midi_test worked without any problems. I have another project, where I use STM's default USB middleware and there I can implement a working USB audio device; I also copied over the clock settings from this project in ...

fallow birchBOT
fallow birchBOT
fallow birchBOT
fallow birchBOT
#

Thanks for coming back to me!

I set debug level to 3 and hooked up tu_printf to an UART. Here's what I got when plugging the device in:

USBD init on controller 0
sizeof(usbd_device_t) = 43
sizeof(tu_fifo_t) = 12
sizeof(tu_edpt_stream_t) = 24
AUDIO init
USBD Bus Reset : Full Speed

USBD Setup Received 80 06 00 01 00 00 40 00
  Get Descriptor Device
  Queue EP 80 with 18 bytes ...
USBD Xfer Complete on EP 80 with 18 bytes
  Queue EP 00 with 0 bytes ...
USBD Xfer Complete...
fallow birchBOT
fallow birchBOT
fallow birchBOT
#

I tried the UAC2 headset example and this seems to work (at least partly).

I got two runtime assertions in dcd_synopsis.c;

  • in handle_rxflvl_ints(), where the switch went to the default branch
  • in dcd_edpt_open(), where TU_ASSERT(sz + _allocated_fifo_words_tx <= EP_FIFO_SIZE/4); failed

but I can stream audio to the device and record it back :-) The recorded audio is a bit corrupted, which I'll investigate now. But still this is a huge step forward for me

fallow birchBOT
#

This fixes https://github.com/hathach/tinyusb/issues/1894. I'm not really sure if this is the correct way to fix it, and I have not tested on all the rest of the family members, however, this lets the i.MX1010 work again.

The problem: the latest SDK update does not enable the data cache by default This causes an assert in board_init() when attemping to control clock gating. I haven't investigated further as to why it's a problem, but it is a problem.

Describe the PR
This PR so...

fallow birchBOT
fallow birchBOT
fallow birchBOT
fallow birchBOT
#
[hathach/tinyusb] New branch created: add\-metro\-rt1011
fallow birchBOT
fallow birchBOT
fallow birchBOT
#

Related area

Class Driver

Hardware specification

Any

Is your feature request related to a problem?

No problem, just ideas.

Since all interface is determined upon connection, dynamic configuration is not possible (I think?). However, if the device can emulate a hub and can then maybe we can connect more devices to this hub to do dynamic configuration on the fly.

Not entirely sure how practical this but just throwing an idea for a potential feature,

Describe the solu...

fallow birchBOT
#

OK tried that; exactly the same issue.

Here are the log reports from the cdc_msc_hid example, at three different debug levels - the last one so you can see the HID report bytes.

With each run I move the joystick in a way which should affect the first byte (containing part of the 10-bit X axis), but the first byte is always zero.

CFG_TUSB_DEBUG == 1

TinyUSB Host CDC MSC HID Example
HID device address = 1, instance = 0 is mounted
HID Interface Protocol = None
HID has 1 r...
fallow birchBOT
fallow birchBOT
#
[hathach/tinyusb] New branch created: update\-pio\-pico\-usb
fallow birchBOT
fallow birchBOT
#

I wouldnt have thought that should be require in IRQ context, but the OHCI spec does disable master interrupts during interrupt servicing

https://ia801603.us.archive.org/4/items/hcir1_0a/hcir1_0a.pdf From page 80.

//
// It is our interrupt, prevent HC from doing it to us again until we are finished
//
DeviceData->HC->HcInterruptDisable = MasterInterruptEnable;

Then at the end

DeviceData->HC->HcInterruptEnable = MasterInterruptEnable;

Perhaps we should be do...

fallow birchBOT
#

Thanks for the link to the OHCI spec - I'd misplaced my copy and couldn't easily find another at the time.

As expected, replacing the WDH disable/enable with MIE disable/enable over the entire interrupt handler results in the same fixed behaviour on my board.

Looking at the issue again it's possible to resolve it without disabling interrupts (MIE or WDH) by writing 0 to HccaDoneHead once the list has been reversed (the example in the spec on page 82 shows it after processing the done li...

fallow birchBOT
#

Operating System

Others

Board

Raspberry Pi Pico

Firmware

https://github.com/rppicomidi/pico-usb-midi-processor

What happened ?

I am developing a new processor class for my project. When I call tud_midi_n_stream_write() to write a system exclusive message to cable 1 instead of cable 0, the message is sent to cable 0.

How to reproduce ?

You can see by inspection of the code near lines 290...

fallow birchBOT
fallow birchBOT
#

Most likely, this is a problem within the RP2040 device controller driver (DCD), where the handling of the ISO EP may not be correct. This was at least the problem for other MCUs. The UAC driver is most likely not to blame, as it works for many MCUs. I did not investigate the RP2040 DCD however. The DCD is furthmore subject to improvements e.g. see #540. If you have time, please feel free to solve this issue and make PR! Thx in advance :)

fallow birchBOT
#

Operating System

Others

Board

Raspberry Pi Pico

Firmware

examples/device/uac2_headset with HID class from examples/device/hid_multiple_interface

What happened ?

Adding a HID or CDC class with the UAC2 example causes it to panic on Android Host. On Windows, the same thing occurs after an uncertain number of play and pauses. Setting CFG_TUSB_DEBUG=2 makes it panic on plugging in. Log and gdb indicates `assertion "hw_data_offset(next_buffer_ptr) <= USB_DPRAM_MAX" fai...

fallow birchBOT
#

btw I have a open PR for a bunch of OHCI tweaks and fixes. Its getting a bit behind master and I should rebase it but it might be worth having a look. #1491

I saw this PR and gave it go to see whether it resolved this issue or not, but it did make the second root hub port on the LPC4088 work as well as the first.

Do you want to include this PR in yours to keep the OHCI fixes together in a single PR?

fallow birchBOT
#

Do you want to include this PR in yours to keep the OHCI fixes together in a single PR
@wooyay Good idea. I have cherry picked your commit and merge it into my PR. I have maintained you as author of the commit ofcourse.

I also went ahead and rebased my PR against current master. If you wish to try it out let me know! a comment in #1491 would be good as it will improve confidence in the PR to help merge to master🤞

fallow birchBOT
#

I also went ahead and rebased my PR against current master. If you wish to try it out let me know! a comment in #1491 would be good as it will improve confidence in the PR to help merge to master🤞

@Ryzee119 Great - I'll take a look and give it a go but it may not be until early next week. I can't see anything to be worried about but I'll leave a comment on #1491 either way and then close this PR.

fallow birchBOT
#

@Ryzee119 I've given this PR a go and it's working on my EA4088 board with both OHCI root hub ports which is excellent.

I needed to make some changes for my environment (OPT_OS_NONE, gcc 10.3.1) to fix some compilation issues:

diff --git a/src/portable/ohci/ohci.c b/src/portable/ohci/ohci.c
index 76f97844c..cd747093a 100644
--- a/src/portable/ohci/ohci.c
+++ b/src/portable/ohci/ohci.c
@@ -35,7 +35,11 @@
 //--------------------------------------------------------------------+...
fallow birchBOT
#

Operating System

MacOS

Board

Seeding Xiao

Firmware

examples/device/audio_test

What happened ?

make: arm-none-eabi-gcc: No such file or directory
make: *** [_build/seeeduino_xiao/obj/src/portable/microchip/samd/dcd_samd.o] Error 1

How to reproduce ?

Try to compile.

Debug Log as txt file

No response

Screenshots

No response

I have checked existing issues, dicussion and documentation

  • [X] I confirm I have checked existing issues, dicussion and ...
fallow birchBOT
#

How do you add the tools to the path?
Current Macs use the Z Shell, so in your home directory there's a file called .zshrc (leading period is important). Edit that file to add the path to wherever the installer put the tools. Tho I think if you installed the tools from the [official ARM package]https://developer.arm.com/-/media/Files/downloads/gnu/12.2.rel1/binrel/arm-gnu-toolchain-12.2.rel1-darwin-arm64-arm-none-eabi.pkg?rev=495058480373470f98133166d00ff0c2&hash=45A682B78E26256ACBB7F13A972...

fallow birchBOT
#

Operating System

MacOS

Board

lpcxpresso55s28

Firmware

Any of the examples.

What happened ?

See here for details, but in a nutshell, the provided makefiles do not build the main.c and other files in the example source directory.

How to reproduce ?

Clone the tinyusb project.
Change to the desired example project directory, e.g., /Users/andy/Projects/tinyusb/examples/device/midi_test

andy@mitzvah midi_te...
fallow birchBOT
#

As a follow-up, I tested this on a Windows 10 box and I got a bunch of different warnings but the files in the example src directory compiled and the whole thing linked.

There must be a difference between whatever make program I have on my Windows box and whatever is provided by Apple in Xcode. If you look at the top of the transcript posted above, you see:

andy@mitzvah midi_test % make BOARD=lpcxpresso55s28 all
realpath: illegal option -- -
usage: realpath [-q] [path ...]
...

fallow birchBOT
#

Operating System

Windows 10

Board

Gd32f470,usb fs register is same as gd32vf103

Firmware

example/device/cdc_dual_ports

What happened ?

when use endpoint 0x83 as EPNUM_CDC_IN,usb print is ok.But use other endpoint ,only about 1000 byte can be printed correctly.The following data are all wrong.

How to reproduce ?

void Usb_CdcSend(uint8_t *pbuf, uint32_t len)
{
uint32_t ret = 0;
tud_cdc_n_write_clear(0);
if (tud_ready())
{
ret = tud_cdc_write(pbuf, ...

fallow birchBOT
#

thank you very much for your PR and sorry for the delay, I was too busy with other paid works. I back off a bit on using TU_STATIC, instead I would prefer to add _fuzz_thread as additional keyword. Even though it is a bit more verbose, the static keyword is more apparent to other user and easier to read.

I also rename macro FUZZ to _FUZZ to avoid if user application define it in the future .

Note: we could change _fuzz_thread to less verbose word in the future if you have any othe...

fallow birchBOT
fallow birchBOT
fallow birchBOT
#
[hathach/tinyusb] New branch created: revert\-1867\-thread\_local\_globals
#
[hathach/tinyusb] New branch created: use\-tu\-static\-for\-fuzz
fallow birchBOT
fallow birchBOT
#

brilliant !! Thank you very much for the PR and sorry for the huge delay. It is my bads, I should have reviewed this earlier. This add great improvement for ohci driver. I did some changes mostly rename to make it more consistent (in my pov):

  • OHCI_RHPORTS to TUP_OHCI_RHPORTS (so that we know where it is defined)
  • tuh_get_virt_addr/tuh_get_phys_addr() to tusb_app_virt_to_phys/tusb_app_phys_to_virt() since the term is more popular
  • as @wooyay pointed out, osal_task_delay() cannot be used...
fallow birchBOT
#

Sorry for the churn on this. I thought it would be useful to include use of tuh_hid_send_report() in example code. In the example, pressing the left and right triggers should control the left and right motors respectively. I don't plan on pushing anything further.

not a problem at all, it is much better to demonstrate API usage with example. Sorry for being late on the review, I will try to review this as soon as I could. Just approve to get ci running (required by github for 1st time co...

fallow birchBOT
#

Operating System

Others

Board

KA-NUCLEO-F411CE

Firmware

src\class\cdc\cdc_device.c

What happened ?

I have described the issue in this post exactly: https://github.com/hathach/tinyusb/discussions/1923#discussioncomment-5099679

The problem in a nutshell, is that the 'epout_buf' and 'epin_buf" members of the 'cdcd_interface_t' struct should be allowed to have different sizes, that correspond to the rx_ff_buf and tx_ff_buf sizes consequently.

How to reproduce ?...

fallow birchBOT
#

Operating System

MacOS

Board

Seeding Xiao

Firmware

Audio_test

What happened ?

realpath: illegal option -- r
usage: realpath [-q] [path ...]
CC dcd_samd.o
make: arm-none-eabi-gcc: No such file or directory
make: *** [_build/seeeduino_xiao/obj/src/portable/microchip/samd/dcd_samd.o] Error 1

How to reproduce ?

Trying to make the example

Debug Log as txt file

No response

Screenshots

No response

I have checked existing issues, dicussion and doc...

fallow birchBOT
#

See the discussion here.

There are two issues here. The first is the error regarding realpath. These error appears when building on macOS. I didn't see it when building on a Windows machine using the GNU tools, especially make. This error hides the real problem.

The Makefile in each example directory has this line:

SRC_C += $(addprefix $(CURRENT_PATH)/, $(EXAMPLE_SOURCE))

and it is apparently...

fallow birchBOT
fallow birchBOT
fallow birchBOT
fallow birchBOT
fallow birchBOT
fallow birchBOT
#

Superb!! Sorry for huge delay, I am in the middle for reviewing this PR. Everything looks great, I am doing mostly clean up to make it more readable. Number of #ifdef in audio driver is starting to look scary now. We should do some refactoring in the future. Overall this PR is awesome and ready to merge, however there is a note in the review, that I think we should change to prevent a read out-of-bound of an array.

fallow birchBOT
#

Following how ST's CubeMX/CubeIDE tools generate RCC init structs and general best practice for usage of a struct like this, instances of RCC_ClkInitTypeDef, RCC_OscInitTypeDef, and RCC_PeriphClkInitTypeDef should all be initialized as empty with = {0};. I've confirmed that failing to do this in the stm32h723nucleo example causes some undefined behavior when implementing a TUSB stack on my own STM32H723 board (I didn't use the example directly but I lifted the contents of the
`board_...

fallow birchBOT
#
[hathach/tinyusb] New branch created: add\-usbip\-fsdev
fallow birchBOT
fallow birchBOT
fallow birchBOT
fallow birchBOT
#
[hathach/tinyusb] New branch created: update\-build
fallow birchBOT
fallow birchBOT
#

Operating System

Linux

Board

Custom, based on STM32F401RBT

Firmware

My firmware is custom, and based on STM32CubeMX. It builds as a simple Makefile project.

  • I use FreeRTOS
  • I use the USB OTG FS port

The following steps were taken to include the tinyusb library and build it:

  • Add tinyusb as a submodule
  • Add the necessary library components to the sources (see below)
  • I use the dcw2 component, as I understand that it supports the STM32F401

Sources

...
#

Just tested the HID composite example, works fine.

[17504.035119] usb 1-1.3: new full-speed USB device number 27 using xhci_hcd
[17504.324266] usb 1-1.3: New USB device found, idVendor=cafe, idProduct=4004, bcdDevice= 1.00
[17504.324282] usb 1-1.3: New USB device strings: Mfr=1, Product=2, SerialNumber=3
[17504.324294] usb 1-1.3: Product: TinyUSB Device
[17504.324305] usb 1-1.3: Manufacturer: TinyUSB
[17504.324316] usb 1-1.3: SerialNumber: 123456
[17504.429244] input: TinyUSB Ti...
#

I tried your suggested fix, but it runs into an assertion in dcd_dwc2.c:658:

  if(dir == TUSB_DIR_OUT)
  {
    // Calculate required size of RX FIFO
    uint16_t const sz = calc_grxfsiz(4*fifo_size, ep_count);

    // If size_rx needs to be extended check if possible and if so enlarge it
    if (dwc2->grxfsiz < sz)
    {
>>  TU_ASSERT(sz + _allocated_fifo_words_tx <= _dwc2_controller[rhport].ep_fifo_size/4);

      // Enlarge RX FIFO
      dwc2->grxfsiz = sz;
    }

...

fallow birchBOT
fallow birchBOT
fallow birchBOT
fallow birchBOT
fallow birchBOT
#

I tested the 4-channel microphone example, and it somewhat works (only with your fix, replacing sizeof()).

Two channels show a sawtooth, two are empty.
Also, I had to drastically increase the level of the sawtooth, otherwise it appeared to be zero.

I increased the dataVal increment from 1 to 200.

  // Generate dummy data
  for (uint16_t cnt = 0; cnt < CFG_TUD_AUDIO_FUNC_1_N_TX_SUPP_SW_FIFO; cnt++)
  {
    uint16_t * p_buff = i2s_dummy_buffer[cnt];              // 2 bytes...
fallow birchBOT
fallow birchBOT
fallow birchBOT
#

which is larger than FIFO size.

since this is in units of 32 bit words, right?

It says in the F401 reference manual:

Program the OTG_FS_GRXFSIZ register, to be able to receive control OUT data
and setup data. If thresholding is not enabled, at a minimum, this must be equal to
1 max packet size of control endpoint 0 + 2 words (for the status of the control
OUT data packet) + 10 words (for setup packets).

I don't see the calculation matching this, but it was probably de...

fallow birchBOT
fallow birchBOT
fallow birchBOT
fallow birchBOT
#

Latest testing with completely unchanged firmware was seemingly successful. I changed the debugger!

  • Previously: Segger J-Link BASE (using Segger GDB server)
  • Now: ST-Link V3 with openocd

I can even start up the device in 96 kHz mode
image

But it fails during use, at dcd_dwc2.c:658, which seems to be expected.


  if(dir == TUSB_DIR_OUT)
  {
    // Calculate req...
fallow birchBOT
fallow birchBOT
#
[hathach/tinyusb] New branch created: minor\-ci
fallow birchBOT
fallow birchBOT
#

@perigoso I am so sorry for the massive delay, Unfortunately, this matter slipped off my radar and the notification got lost amidst others. I admit that my lack of familiarity with Renesas MCUs make me not able to follow up on this matter more closely.

I am gonna try to sync this with master, review and pull out my boards to test, hopefully we could merge this soon as it should be.

Sorry again

fallow birchBOT
fallow birchBOT
#

Hi @hathach , unfortunately I no longer have access to the renesas development boards (job change), but I'm happy to see this being picked up

hopefully it's not too much work, the more conflicting change might be the RTOS changes

Thank you, RTOS change is minor comparing to the whole PR. It is totally my fault, I am trying to fix/merge this as soon as I could :)

fallow birchBOT
#

Add support for the updated fsdev peripheral in STM32G0 MCUs.

Compared with older fsdev revisions, the STM32G0 variant renamed a lot of registers & fields, some registers were extended from 16 to 32 bits and the USB memory addressing scheme was changed:

  • In older versions, USB "PMA" memory had to be accessed using 8 or 16 bit instructions, 32 bit access did not work out.
  • In the new version, all PMA accesses have to be 32 bit, 16 bit instructions do not seem to work any more.

Th...

fallow birchBOT
fallow birchBOT
#
[hathach/tinyusb] New branch created: renesas\-ra
fallow birchBOT
fallow birchBOT
fallow birchBOT
#

Operating System

Linux

Board

RP2040

Firmware

latest master, as of today

What happened ?

I'm bringing CircuitPython's use of tinyusb up to date. We were about a year behind. I'm getting a compile error here because the macro remove_volatile_cast() is not defined here:
https://github.com/hathach/tinyusb/blob/990fb6ae5c4d9d4b77c5a9ecb3a2abe899dd2712/src/portable/raspberrypi/rp2040/dcd_rp2040.c#L300
It is defined in `pico-sdk/src/rp2_common/hardware_sync/include/hardw...

fallow birchBOT
#

Operating System

Linux

Board

RP2040

Firmware

latest master, as of today

What happened ?

I'm bringing CircuitPython's use of tinyusb up to date. We were about a year behind. Compile error because CFG_TUSB_RHPORT1_MODE is not defined. This used to work, but I think that #1350 may have changed things.
https://github.com/hathach/tinyusb/blob/990fb6ae5c4d9d4b77c5a9ecb3a2abe899dd2712/src/portable/st/synopsys/dcd_synopsys.c#L528
The statement above is not guarded with `#...

fallow birchBOT
fallow birchBOT
#

For incoming ISO OUT packets it was possible to start DMA from endpoint to RAM before transfer was started resulting in unrelated memory corruption.
This is scenario that causes memory corruption:

  • ISO OUT packet is received
  • Packet is transferred by DMA to transfer buffer
  • xfer->started is cleared and xfer->buffer is updated as it is in every case
  • Application takes to long to handle it (it happens when debugger is connected breakpoint is hit slowing down software).
  • Next ISO OUT ...
fallow birchBOT
fallow birchBOT
fallow birchBOT
#
[hathach/tinyusb] New branch created: remove\-submodules
fallow birchBOT
#

Describe the PR
fix #1464 remove all submodules in hw/mcu, these repo is now managed by an python script at tools/get_deps.py which take 'submodule' path as inputs. The existing way to get dependency with make target make BOARD={} get-deps still works by invoking get_deps.py script.

This is due to the wide range support of MCUs and the mcu sdk is often large enough. git submodule init --recursive which is convenient for most user project had a hard time with tinyusb.

fallow birchBOT
#
  • Fixes #1944.

https://github.com/hathach/tinyusb/blob/990fb6ae5c4d9d4b77c5a9ecb3a2abe899dd2712/src/portable/raspberrypi/rp2040/dcd_rp2040.c#L300
dcd_rp2040.c uses remove_volatile_cast(), which is defined in the pico-sdk in hardware/sync.h. But dcd_rp2040.c does not #include hardware/sync.h. When not using the pico-sdk build environment and OSAL_PICO, remove_volatile_cast() will not be defined. This PR adds an explicit #include to fix that.

fallow birchBOT
#

Operating System

Windows 11

Board

STM32F401 custom design

Firmware

Same as https://github.com/hathach/tinyusb/issues/1935
(CubeMX Makefile project on FREERTOS, using the new dcd_dwc2 driver)

What happened ?

In general, I can connect the USB device and I can play music or loop it back to the microphone without issues. The looped back signal looks like the one I transmitted.

Now, there are two cases:

  1. I pause/stop the music, disconnect USB, reconnect USB -> **no ...
fallow birchBOT
#
[hathach/tinyusb] New branch created: update\-get\-deps
#
[hathach/tinyusb] New branch created: renesas\-ra
fallow birchBOT
fallow birchBOT
fallow birchBOT
#

hihi, thank you @howard0su for the PR, and sorry for late response. Recently, we have added a new API for ISO transfer, that would reserve the largest packet size before SET_INTERFACE (activation). This will help to solve the changing endpoint size of ISO transfer.

https://github.com/hathach/tinyusb/blob/master/src/device/dcd.h#L172-L175

The API is currently only implemented with stm32 fsdev, but will be added for rp2040 later as well when I have time. I appreciate your effort but I t...

fallow birchBOT
fallow birchBOT
#

@perigoso I have made some minor commits and I think we are really close to merge this. I only have an question regarding the IRQn number used by RA chip as mentioned above. That is ok if you don't remember that, we can merge it as it is for now and worry about that later on.

Another thing is the name of USB IP, I did a quick search on renesas page. As far as I can tell, Link is not the name of the controller, it seems to be used in place for connectivity, there is also sata, pcie link. If...

fallow birchBOT
#

thank you for your PR, I just did a quick search to find a G0 board to test with. Though look like all the G0 nucleo does not come with USB connector for user. Can we use an usb breakout to D+/D- to those board to test with. Or do we need to add additional passive (RC) to it. An nucleo BSP is definitely helping, it will make it easier for other maintainers to test with and also add it into ci run as well.

fallow birchBOT
#

At the moment, only STM32G0B1 and STM32G0C1 devices have USB peripherals.
The only affordable development board (STM32G0C1VE-EV is too expensive for me) seems to be the NUCLEO-G0B1RE.

And I'm not sure whether the nucleo has a "User USB" connector or not.

The image on the ST web page says no, but looking closely on the chip package, the pictured board has the wrong (STM32G071) MCU, so maybe that image just shows some random n...

fallow birchBOT
fallow birchBOT
#

FIFO based R/W functions dcd_read_packet_memory_ff() and dcd_write_packet_memory_ff() need to be modified for 32bit alignment.

image

Both linear & wrapped parts of the circular fifo need to be read/write from/to the packet buffer.

In 16bit case linear part can only be odd or even so it's easy to handle.

Now linear part can remain 0-3 bytes after last 32bit aligned transfer...

fallow birchBOT
fallow birchBOT
fallow birchBOT
fallow birchBOT
#

Discussed in https://github.com/hathach/tinyusb/discussions/1466

Originally posted by smunaut May 21, 2022
So for a given application, I'd like to defer the decisions of OK/Error and not provide them directly as returns to the callbacks.

That is, once I get the SETUP stage, I can't immediately decide if it should stall or start a transfer. And for OUT transactions, when I get the DATA in the xfer completion callback, I can't immediately decide if the status stage should be ...

fallow birchBOT
#

Another thing is the name of USB IP, I did a quick search on renesas page. As far as I can tell, Link is not the name of the controller, it seems to be used in place for connectivity, there is also sata, pcie link. If you don't mind I would suggest to rename the usbip back to simply renesas ? ofc, I will do that myself.

I don't remember where I got the IP name, but I can't seem to find anything, renaming things back is fine by me

#

Another thing is the name of USB IP, I did a quick search on renesas page. As far as I can tell, Link is not the name of the controller, it seems to be used in place for connectivity, there is also sata, pcie link. If you don't mind I would suggest to rename the usbip back to simply renesas ? ofc, I will do that myself.

I don't remember where I got the IP name, I might have misread something, renaming things back is fine by me

fallow birchBOT
fallow birchBOT
#
[hathach/tinyusb] New branch created: fix\-old\-picosdk
fallow birchBOT
fallow birchBOT
fallow birchBOT
fallow birchBOT
#
[hathach/tinyusb] New branch created: renesas\-ra
fallow birchBOT
#
[hathach/tinyusb] New branch created: renesas\-ra
fallow birchBOT
#

Superb! Thank you @perigoso very much for generalizing the renesas driver and sorry for the huge delay. I was too busy last time (around last Lunar New Year), and lots of stuffs happening making this fall off my radar. Though that is still hugely my bad.

I made some changes but should not cause any issue since I tested with both RA and RX boards

  • Add ra4m1_ek board, which I have. I also have an ra6m1_ek but that can wait for next PR. Note bsp for RA can be refactor to reduce code a bit ...
fallow birchBOT
#
[hathach/tinyusb] New branch created: fix\-host\-enumerate\-mul\-device
fallow birchBOT
#

Describe the PR
Note: changes looks massive but mostly whitespace.

  • Removed all remainding submodules
  • bump up freeRTOS deps to 10.5.1
  • fix al trailing space and new line with pre-commit
  • fix all typos suggested by codespell
  • configuring codespell to pre-commit hook
  • run pre-commit in ci (which also run codespell and unit-test)
fallow birchBOT
#

@hathach No worries, thank you for picking this up, very happy to see this merged :)

you might want to rename the LINK_REG macro too, on the implementation files, since that was based on the Link name for the core, and now may cause confusion for readers without context

I will take this opportunity to point you at another one of my PR that you might have also missed, if you have a little time to help with that #892

#

thank you very much for the PR, regarding the HSE_VALUE which is 12Mhz on some boards. I have updated the mm32sdk to add ifndef around the defined of SYSCLK_FREQ_XXMHz/SYSCLK_HSI_XXMHz and also add 1-DHSE_VALUE=` to board.mk that matches its hardware. This should solve this issue https://github.com/hathach/tinyusb/pull/1882/files#diff-d115a2b59f4f8d51aef8da0070cea68b35df06cb687b844eba59de2f7db7baa9R2

To be honest, mm32 isn't doing its work to maintain the driver. Requiring chaning the syst...

fallow birchBOT
fallow birchBOT
#
[hathach/tinyusb] New branch created: portability
fallow birchBOT
fallow birchBOT
fallow birchBOT
fallow birchBOT
#
[hathach/tinyusb] New branch created: update\-bsp
fallow birchBOT
fallow birchBOT
fallow birchBOT
#
[hathach/tinyusb] New branch created: rp2040\-more\-iar
fallow birchBOT
fallow birchBOT
#
[hathach/tinyusb] New branch created: support\-ik
#
[hathach/tinyusb] New branch created: add\-tuh\-set\-interface
fallow birchBOT
fallow birchBOT
fallow birchBOT
#
[hathach/tinyusb] New branch created: refactor\-hid\-host
fallow birchBOT
#

Describe the PR

  • relax hid host enumeration, allow set protocol to be stalled
  • add note for blocking tuh_configuration_set(), tuh_interface_set()
  • change meaning of CFG_TUH_HID to total number of HID interfaces supported. Previously CFG_TUH_HID is max number of interfaces per device which is rather limited and consume more resources than needed.
  • fine tune CFG_TUH_HID value to 3*max_device (previously must be 4*dev and yet couldn't support 1 device with 5 interfaces while other ...
fallow birchBOT
fallow birchBOT
fallow birchBOT
#
[hathach/tinyusb] New branch created: fix\-tmc488\-bit\-order\-1658
fallow birchBOT
#

Tracing my original code (https://github.com/rabbitholecomputing/QuokkADB-firmware) the issue is _ctrl_xfer.stage == CONTROL_STAGE_IDLE);
fails because _ctrl_xfer.stage is equal to CONTROL_STAGE_ACK.

There is only 1 control transfer is active at a time, if it failed, try again later. You can implement your own fifo to queue up the pending control transfer.

#

@HiFiPhile the callback is already existed, did you mean you want to implement it.

https://github.com/hathach/tinyusb/blob/081e4eecba3c91f08cdf96b0a090e7726cec3727/examples/device/cdc_msc/src/usb_descriptors.c#L254

Yeah, I am planning to add and board_get_uid()/board_get_usb_serial() similar to this implementation of tinyuf2 here, but always got too busy with other works.

https://github.com/adafruit/tinyuf2/blob/4fb0d86fe82659d599b034864f8b1aee1656de75/src/usb_descri...

fallow birchBOT
fallow birchBOT
#

Related area

all

Hardware specification

all

Is your feature request related to a problem?

similar to #1855 but in much broader view. There is several analytic software that is free for opensource project. That does perform code checking againt popular standard e.g MISRA, CERT etc ... we should run as much as we could with CI to make tinyusb safer.

Describe the solution you'd like

Doable

  • [ ] Coverity: partial configured should have been done betterhttps://scan.coverit...
fallow birchBOT
#
[hathach/tinyusb] New branch created: pico\-pio\-name
fallow birchBOT
#
[hathach/tinyusb] New branch created: update\-doc
fallow birchBOT
#

Operating System

Others

Board

N/A

Firmware

N/A

What happened ?

epin_buf and epout_buf should have CFG_TUSB_MEM_ALIGN in hidh_interface_t (HOST)

https://github.com/hathach/tinyusb/blob/master/src/class/hid/hid_host.c#L57

similar to what is in (DEVICE)

https://github.com/hathach/tinyusb/blob/master/src/class/hid/hid_device.c#L53

How to reproduce ?

it's a "bug" in the code (of course the code not working buffer in driver is required to be aligned...

fallow birchBOT
#

it's a CH582M from WCH (https://aliexpress.com/item/1005004587076215.html) which is not supported here but I did "dirty" host implementation (I will share the code when I finish implementation)

It requires RX buffer to be aligned so either

hid host structure should looks like

typedef struct
{
  uint8_t itf_num;
  uint8_t ep_in;
  uint8_t ep_out;

  uint8_t itf_protocol;   // None, Keyboard, Mouse
  uint8_t protocol_mode;  // Boot (0) or Report protocol (1)

  uint8_t ...
fallow birchBOT
#

more info ... in my implementation of bool hcd_edpt_xfer(uint8_t rhport, uint8_t dev_addr, uint8_t ep_addr, uint8_t * buffer, uint16_t buflen)

I had

R16_U2H_RX_DMA = (uint16_t)(uint32_t)buffer;
StartTransact(...);

where R16_U2H_RX_DMA is register where you write the pointer to buffer for transfer

since hidh_xfer_cb in hid_host.c is using tuh_hid_report_received_cb(dev_addr, instance, hid_itf->epin_buf, (uint16_t) xferred_bytes) to call this implementation it wou...

fallow birchBOT
#

Describe the PR
When working with TinyUSB, my IDE (VSCode) sorted the #includes for tusb_private.h as part of automated code formatting which revealed an implicit dependency on tusb.h via build breaks when tusb_private.h is #included without/before tusb.h.

This PR simply adds the implicit dependency as an explicit dependency, fixing the build break if the #include statements are ordered differently (for example in tusb.c).

Additional context
VSCode auto-formatting changed tusb...

fallow birchBOT
fallow birchBOT
fallow birchBOT
#
[hathach/tinyusb] New branch created: fix\-align\-host
#

Describe the PR
fix #1976 , host and device controller may have different requirement for memory section (location) and alignment. It is better to separte these configuration. CFG_TUSB_MEM_SECTION and CFG_TUSB_MEM_ALIGN can still be used as backward compatible. However, these should be used in the future (gradually migrate device & example later)

  • CFG_TUD_MEM_SECTION and CFG_TUD_MEM_ALIGN
  • CFG_TUH_MEM_SECTION and CFG_TUH_MEM_ALIGN
fallow birchBOT
fallow birchBOT
#
[hathach/tinyusb] New branch created: fix\-cdc\-host\-unsupported\-line\-request
fallow birchBOT
#

Related area

device stack

Hardware specification

rp2040 pico-w

Is your feature request related to a problem?

I have an odd-ball usb-host msc application using this SD-card to usb cable: https://www.spypoint.com/en/products/cell-link-cable/cl-cbl . I'm plugging the usb end into a pico-w and the SD card end into a camera. When the camera is off or idle you can access the SD card memory via the usb as a regular usb mass storage device from the pico. But when the camera becomes a...

#

This issue does not seem to be fixed. I am using earlephilhower's arduino-pico framework and updated it's pico-sdk to use the latest state of tinyusb. The issue still exists.

Submodule path 'pico-sdk/lib/tinyusb/hw/mcu/st/stm32u5xx_hal_driver': checked out '2e1d4cdb386e33391cb261dfff4fefa92e4aa35a'
Submodule path 'pico-sdk/lib/tinyusb/hw/mcu/st/stm32wbxx_hal_driver': checked out '2c5f06638be516c1b772f768456ba637f077bac8'
Submodule path 'pico-sdk/lib/tinyusb/hw/mcu/ti': checked out '14...
fallow birchBOT
#

Operating System

Windows 10

Board

RP2040 (TinyRP2040 and Pico)

Firmware

I have this issue with pico-sdk and circuitpython (after 7.3.3).

What happened ?

CDC is not working on windows (multiple machines). The com port is visible and I can connect to it, but no data seems to be transferred.

How to reproduce ?

A simple cdc program is enough to reproduce this.

  • I didn't find this a simular issue, but my english is not the best. -

Debug Log as txt file

_No re...

fallow birchBOT
fallow birchBOT
#

Operating System

Linux

Board

Custom RP2040 Board

Firmware

https://github.com/Black-FX/RP2040_Mouse

What happened ?

I have developed a firmware for RP2040 to be used as a USB to quadrature mouse adaptor. I have the code there to handle mouse scroll events but none ever appear.

How to reproduce ?

  1. Compile firmware and flash to an RP2040 board.
  2. Connect a USB mouse using PIN8 for D+ and PIN9 for D-
  3. Attempt to use scroll wheel, nothing happens
    4

Debug ...

fallow birchBOT
#

Related area

Class driver extension

Hardware specification

N/A

Is your feature request related to a problem?

I'm trying to move an existing codebase from the ST USB middleware to tinyUSB and running into trouble fully supporting the video (UVC) interface. In particular, it appears to me that tinyUSB does not support defining extension units and perhaps processing units in general. I'm trying to modify tinyusb to support my usecase, but I'm having trouble understanding the dif...

fallow birchBOT
#

Operating System

Linux

Board

ESP32S3

Firmware

IDF-5.0 and tinyUSB

What happened ?

When I create a composite HID device with ESP32S3, I encounter a problem where the PC cannot connect to the device, regardless of whether the configuration descriptor exceeds 64 bytes or not. The composite device consists of a Generic Input Output Device, a Keyboard Device, and a Mouse Device.

How to reproduce ?

composite generic input/output and keyboard desc:
const uint8_ t mine_ ...

fallow birchBOT
fallow birchBOT
fallow birchBOT
#

I think it's a good idea to add a set of generic callback functions, similar to the audio class. The functions shown below.
https://github.com/hathach/tinyusb/blob/5add4c97fa834004e6a3b267345a13c6d3c9514a/src/class/audio/audio_device.c#L1882
https://github.com/hathach/tinyusb/blob/5add4c97fa834004e6a3b267345a13c6d3c9514a/src/class/audio/audio_device.c#L1981
When I initially implemented the video class, I thought so.
If frequently used properties comes up, it would be better to replace the...

fallow birchBOT
fallow birchBOT
#

Describe the PR
Add handling bulk endpoints in streaming interface. This feature is only compatible with streaming, and the still image capture function is not yet implemented.

Using bulk endpoints may allow for more bandwidth utilization than isochronous endpoints. It may also enable higher image sizes and frame rates.

Additional context
I have tested this PR on Raspberry Pi Pico and Windows 11.
I have confirmed that the video_capture can display color bars up to 128x96 60...

fallow birchBOT
fallow birchBOT
fallow birchBOT
#

CUSTOM since NONE use hcd_frame_number to implement osal_task_delay but board/chip SDK has already mDelaymS

tusb_config.h


/* 
 * The MIT License (MIT)
 *
 * Copyright (c) 2019 Ha Thach (tinyusb.org)
 *
 * Permission is hereby granted, free of charge, to any person obtaining a copy
 * of this software and associated documentation files (the "Software"), to deal
 * in the Software without restriction, including without limitation the rights
 * to use, copy, modify, merg...
fallow birchBOT
#

Related area

Host, osal_task_delay

Hardware specification

Any

Is your feature request related to a problem?

I'm using non supported here MCU/Board and I wan use OS_NONE but provide custom osal_task_delay

Describe the solution you'd like

in osal_none.h

#if CFG_TUH_ENABLED
// currently only needed/available in host mode
#ifdef SOME_CONFIG_FLAG
#include "tusb_os_none.h" //provided by platform implemetation of osal_task_delay
#else
void osal_task_delay(uint32...
fallow birchBOT
fallow birchBOT
#

Please forgive my ignorance for not giving this debug message in the first time.
This is a debug message about "compound IO and keyboard device", failed:

USBD Bus Reset : Full Speed

USBD Setup Received 80 06 00 01 00 00 40 00
  Get Descriptor Device
  Queue EP 80 with 18 bytes ...
USBD Xfer Complete on EP 80 with 18 bytes
  Queue EP 00 with 0 bytes ...
USBD Xfer Complete on EP 00 with 0 bytes
USBD Bus Reset : Full Speed

USBD Setup Received 00 05 18 00 00 00 00 00
  S...
fallow birchBOT
#

An alternative to parsing the HID report descriptor is to ask the caller to pass the information that would be retrieved from the parsing. We do this in CircuitPython, passing in the report IDs and the report lengths: https://docs.circuitpython.org/en/latest/shared-bindings/usb_hid/index.html#usb_hid.Device.

An HID report descriptor parser is useful for other things too, especially host support, so this may not be the best choice in the long run. But it saved writing a parser, especially b...

fallow birchBOT
#

Use usbd_edpt_claim, usbd_edpt_release in vendor device class

An issue similar to https://github.com/hathach/tinyusb/issues/1470 was discovered in my testing on a PCA10059 running MyNewt/Nimble. This PR ports over the use of the endpoint claim and release mechanisms used in the cdc class, which seems similar. This resolved the race condition I encountered that would result in IN transfers getting stuck until the next OUT transfer was started.

fallow birchBOT
#

Related area

device stack, hid

Hardware specification

all

Is your feature request related to a problem?

without parser, device hid driver does not know if report id is part of the report or not and sometime may present data especially output report incorrectly ID = invalid + whole report. This may confuse application if not aware of the issue.

Describe the solution you'd like

simple parser enough to detect report ID present.

@dhalbert

I have checked existing is...

#

Related area

Host Driver (HCD)

Hardware specification

all

Is your feature request related to a problem?

currently only standard ACM device is supported. vendor usb uart bridge chip aren't tested yet (probably using vendor specific driver).

Describe the solution you'd like

Add host driver for those since they are popular enough on older design.

@ladyada

I have checked existing issues, dicussion and documentation

  • [X] I confirm I have checked existing issues, ...
fallow birchBOT
fallow birchBOT
#

Describe the PR
This draft pull request shows a possible way to implement FreeRTOS support for RP2040.
To use FreeRTOS with RP2040, you must install the FreeRTOS-Kernel source in a way that family.cmake can find it. Easiest place to put it is

    ${PICO_SDK_PATH}/../FreeRTOS-Kernel

Make sure to use the smp branch. That is:

    cd ${PICO_SDK_PATH}/../FreeRTOS-Kernel
    git checkout smp

In your project's CMakeFiles.txt, use libraries

    tinyusb_board_freer...
fallow birchBOT
#

Describe the PR
This is a very early driver for the fs/otg usb IP found in wch chips (device mode only)
Tested on CH32V307 and partially on CH32V303.
That IP may be present in other WCH chips such as CH32V2xx etc...
This PR is a request for comment mostly (see below)

Additional context
The driver is derived from the HS one but targets the FS/OTG usb controller, with the same restrictions (resume/stall not supported, no cleanup...).
These IPs are similar but not compatible. I'...

fallow birchBOT
#

Related area

UVC

Hardware specification

rp2040

Is your feature request related to a problem?

UVC example misses VC_PROCESSING_UNIT which is needed for controlling things like brightness.

Describe the solution you'd like

I want to get callback when user changes brightness from webcam program.

I have checked existing issues, dicussion and documentation

  • [X] I confirm I have checked existing issues, dicussion and documentation.
fallow birchBOT
#

@tobozo this is great, but if abs_mouse is to be a first-class citizen in TinyUSB, shouldn't we add a couple helper functions to hid_device.h to match the base mouse?

Like:

bool tud_hid_n_abs_mouse_report(uint8_t instance, uint8_t report_id, uint8_t buttons, int16_t x, int16_t y, int8_t vertical, int8_t horizontal);`

static inline bool tud_hid_abs_mouse_report(uint8_t report_id, uint8_t buttons, int16_t x, int16_t y, int8_t vertical, int8_t horizontal)
{
  return tud_hid_n_ab...
fallow birchBOT
#

@earlephilhower thanks for the suggestion :+1: should I also add the C function in hid_device.c ?

bool tud_hid_n_abs_mouse_report(uint8_t instance, uint8_t report_id, uint8_t buttons, int16_t x, int16_t y, int8_t vertical, int8_t horizontal)
{
  hid_abs_mouse_report_t report =
  {
    .buttons = buttons,
    .x       = x,
    .y       = y,
    .wheel   = vertical,
    .pan     = horizontal
  };
  return tud_hid_n_report(instance, report_id, &report, sizeof(report));
}
fallow birchBOT
fallow birchBOT
#

ideally the touch zone should have a shape proportional to the target screen so it's not exactly as intuitive as using the relative mouse, especially when the desktop has multiple screens :sweat:

there are a lot of use cases anyway, I remember exploring those with an ESP32-S2:

  • physical mouse
  • physical touchpad (e.g. using a XPT2046)
  • mouse server (e.g. forwards mouse reports from a http client to the host)
  • scripted mouse (e.g. [drawing hand in an image editor](https://www.you...
fallow birchBOT
fallow birchBOT
fallow birchBOT
fallow birchBOT
fallow birchBOT
#

Operating System

Linux

Board

Raspberry Pi Pico

Firmware

/examples/host/cdc_msc_hid

What happened ?

When connecting a USB keyboard (or mouse) to the Pico via a USB hub, the process fails when trying to setup the keyboard (or mouse) throwing a Data Seq Error.

How to reproduce ?

  1. Apply power to Pico
  2. Connect USB hub to Pico
  3. Connect a USB keyboard (or mouse) to the USB hub
    Or
  4. Connect USB hub to Pico
  5. Connect a USB keyboard (or mouse) to the USB hub
    3...
fallow birchBOT
#
[hathach/tinyusb] New branch created: cmake
fallow birchBOT
fallow birchBOT
fallow birchBOT
#

will revise other mcu and make an PR to fix this, btw, I have ordered a few more wch boards, they seem to look good on specs. Though to be honest, I am not familliar with wch family.

BTW, I've also ordered WCH-Link and 203 board ... And have a problem to make it even blink beacause in fact LEDs(2 and 3 as 1 is just power) ARE NOT CONNECTED TO ANY PIN ... you need to connect LED pins to some pins (fx I've connected it to PA0 here)
![image](https://user-images.githubusercontent.com/12524...

fallow birchBOT
#

Describe the PR
Adds support for STM32L5 MCUs

Additional context
Tested on STM32L552RCT on custom board in crystalless mode using clock recovery system (CRS). Only additional setup required is APB clock to USB, CRS setup and enabling VDDUSB via PWR->CR2.

USB_PMAADDR is not defined in stm cmsis headers but rather USB_PMAADDR_S and USB_PMAADDR_NS (secure and non-secure modes respectively). The definition here is relative to USB_BASE which defaults to USB_BASE_NS but the curren...

fallow birchBOT
#

Related area

hcd, dcd

Hardware specification

all

Is your feature request related to a problem?

The MAX3421E USB peripheral/host controller via SPI transportation, commonly used in Arduino Host Shield. Haven't looked at the chip datasheet, but if we could support this chip it would make it possible to run TinyUSB host on most of mcu on Arduino platform

Describe the solution you'd like

TBD

@ladyada

I have checked existing issues, dicussion and documentation

  • [X...
fallow birchBOT
fallow birchBOT
#

Operating System

MacOS

Board

Raspberry Pi Pico

Firmware

issue.zip

What happened ?

I was trying to follow along rumbledethumps picocomputer project using MacOS as host and ran into a problem with sending serial break from Mac host to the Raspberry Py pico running an image containing tinyUSB and picoprobe. I have confirmed that break works fine from a Linux host (and I have been told it also works on Windows...

fallow birchBOT
fallow birchBOT
fallow birchBOT
fallow birchBOT
fallow birchBOT
fallow birchBOT
fallow birchBOT
#

I have tested on a custom PCB and a generic HID in/out test works as expected. Unfortunately I do not have a development board (Nucleo/Disco etc) to test on.

The STML412Nucleo bsp seems to be the most similar with only the GPIO assignments for LEDs/button/UART differing. I can edit this and attach if requested however it would be untested.

That is OK, I thought you are using one of ST devboard, adding bsp actually allow the ci to run that could potentially rule out some mistake. B...

fallow birchBOT
#

Thanks for quick response!

  • you double checked that macOS indeed send out BREAK signal ?

    Yes, by way of a USB to Serial adapter board connected to the UART pins on the pico. This board passes the break from both MacOS and Linux minicom.

  • please test again with cdc_msc example, you will need to add the break callback to main.c. Since that is what I am always testing with.
    

    **I have now modified hello.c, adding a callback and printing a BREAK message when detecting a...

fallow birchBOT
fallow birchBOT
#

@hathach The build pre-comit is failing. I do not understand why file FreeRTOS_Kernel_import.cmake requires a blank line at the end of the file. The file pico_sdk_import.cmake does not have one.

You need to leave an empty line at the end of the file to make ci check happy. On my editor the pico_sdk_import.cmake does have one.

image

#

Yes, by way of a USB to Serial adapter board connected to the UART pins on the pico. This board passes the break from both MacOS and Linux minicom.

Which Serial Adapter, FTDI/CP2104 using different driver than ACM, you need to double check to see if BREAK is indeed sent over ttyACM (not ttyUSB with other device).

I have now modified hello.c, adding a callback and printing a BREAK message when detecting a break. Running the cdc_msc example produces the same result as my previous tes...

fallow birchBOT
fallow birchBOT
fallow birchBOT
#

Operating System

Linux

Board

NA

Firmware

CDC-NCM /src/class/net/ncm_device.c

What happened ?

  1. NCM dev class is unable to handle NTB of size > 512B i.e any NTB transfer which requires more than 1 OUT transfers.
static void handle_incoming_datagram(uint32_t len)
{
  uint32_t size = len;

  if (len == 0) {
    return;
  }

  TU_ASSERT(size >= sizeof(nth16_t), );

  const nth16_t *hdr = (const nth16_t *)receive_ntb;
  TU_ASSERT(hdr->dwSignature == NTH...
fallow birchBOT
fallow birchBOT
fallow birchBOT
fallow birchBOT
#
[hathach/tinyusb] New branch created: add\-hid\-host\-ready
fallow birchBOT
fallow birchBOT
#

Hi @hathach - The CDC + UAC2 composite device happens to be important especially in the amateur radio community.

Modern radios ('rigs') like Icom IC-7300 + IC-705 expose a sound card and a serial device ('composite device') to the computer over a single USB cable. This allows for Audio I/O and CAT control over a single USB cable which is very convenient.

By including (and enhancing) the example in this PR, we enable the amateur radio community to build ('homebrew') radios with similar f...

fallow birchBOT
fallow birchBOT
#

Operating System

Windows 11

Board

esp32 s3

Firmware

default

What happened ?

null action

How to reproduce ?

no

Debug Log as txt file (LOG/CFG_TUSB_DEBUG=2)

no

Screenshots

origin code:

uint8_t const tud_descriptor_configuration_cb(uint8_t index)
{
(void)index; // for multiple configurations
return (uint8_t const
)EspTinyUSB::descriptor_config_if;
}

I have checked existing issues, dicussion and documentation

  • [X] I confirm I have ...
slow hinge
#

Can tinyusb emulate vendor specific devices

#

Such as an xbox periferal?

fallow birchBOT
fallow birchBOT
fallow birchBOT
#
[hathach/tinyusb] New branch created: pr2015
fallow birchBOT
fallow birchBOT
#

Describe the PR
Even when we get an empty "status change" interrupt from a hub, schedule another interrupt poll.

During enumeration, when there are multiple devices attached to the hub as it's plugged into the Pi Pico, enumeration hangs, because we get a "status change" callback with value zero. With this patch, we retry several times on "zero" status change callbacks, until eventually we succeed.

Additional context
If applicable, add any other context about the PR and/or scre...

fallow birchBOT
#

So I managed to get my hands on a Sabrent HB-MCRM and everything seems to be working fine with that (log of working one here).

The Sabrent one isn't mine (so I didn't tear it apart) but it seems to claim it's using a Genesys Logic controller... probably a GL850G.

The one that doesn't work is a no-name brand... looks like the controller is actually a Huasheng Electronics HS8836A which seems to be foun...

fallow birchBOT
fallow birchBOT
#

Operating System

Linux

Board

Pico 2040, ESP32-C3 and ESP32-S3

Firmware

Pico SDK 1.5.0 with default TinyUSB submodules.
Espressiv SDK 11.2.0 with default TinyUSB submodules.

What happened ?

Correct me if I'm doing something wrong, but here's what I'm observing when trying to use the least power on the USB device by not doing uneccessary operations, such as spamming a HID report when not needed:

I have a gamepad device report mechanism based on the TinyUSB examples.
...

fallow birchBOT
#

This fixes https://github.com/hathach/tinyusb/issues/1830

Some context: https://github.com/raspberrypi/pico-feedback/issues/324

This commit makes it so that when setting the START_TRANS bit in the SIE_CTRL register, along with some other bits, we first set all the other bits, then wait some cycles, and then set the START_TRANS bit.

Doing so protects against a situation where the USB controller is reading the register at the same time and gets an incorrect value.

The assembler part...

fallow birchBOT
fallow birchBOT
#

Not so hack and dirty implementation (finally got IRQ work form me) for CH32V20x
https://gist.github.com/SelvinPL/68637937286e4d530a0f6a58807850a3 (MIT License - you can use it)
(to compile you need to comment osal_task_delay in tinyusb source , connected to: https://github.com/hathach/tinyusb/issues/1987 - i could not find a way to get frame count)

BTW it can be ported to 58x since USB registers are the same (just start at different place)
from20x SDK

typedef struct
{
    __I...
fallow birchBOT
#
[hathach/tinyusb] New branch created: pr1942
fallow birchBOT
#

Finally I've got my hands on G0 :)

I'm using a STM32G0B0RET6 soldered on NUCLEO-G071RB and a USB breakout cable.

I've added a NUCLEO-G0B1RE BSP, since B0 and B1 devices are very similar I'm compiling as STM32G0B1RET6, the only deference is B0 doesn't has HSI48 so I'm using HSE PLL clock in the BSP.

cdc_msc example tested ok, there are some remaining works:

  • [ ] B0 use USB_IRQHandler naming
  • [ ] Add 32bit FIFO transfer support
  • [ ] Cleanup, I don't think `reg16_clear_bits(...
fallow birchBOT
#

OK, I am back. I have now built the modified cdc-msc example in the tinyusb example tree:

make BOARD=raspberry_pi_pico DEBUG=1 LOG=2 all

with my modified main.c, as attached earlier.

But, alas, not much new to report. The break is detected when connected to /dev/ttyACM0, but not when using MacOS, where there is no /dev/ttyACMx, but the pico usb is seen as /dev/tty.usbserial-0001. Logging over the pico UART does not display anything, so I have nothing more to attach, I'm afraid. I ...

fallow birchBOT
#

With #define CFG_TUSB_DEBUG 3 this breaks connecting to an USB keyboard, it is an old Apple M7803. I attached the log with ipopov's pull request code and the previous commit in his repo, hash: 28817a715024c82b78f9b9d19f37a72771870759

The error with ipopov's code comes up as Queue EP 81 with 1 bytes ... usbh_edpt_xfer_with_callback 781: ASSERT FAILED

ipopov's code works find with #define CFG_TUSB_DEBUG 0

I was hoping this pull request would fix an issue with an unbranded two ...

fallow birchBOT
#

Adds more in depth documentation of how tud_task does not need to be polled in implementations that use an RTOS / scheduler.

Describe the PR
This adds documentaiton showing how tud_task doesn't need to hold the CPU through polling when tusb_config.h is set to use an RTOS.

Additional context
If applicable, add any other context about the PR and/or screenshots here.

fallow birchBOT
fallow birchBOT
fallow birchBOT
fallow birchBOT
fallow birchBOT
#

I have the same experience with Bluetooth SPP (rfcomm) on macos, basically it ignores some of cotnrol signals. That is why I suspect that macos does not send BREAK signal to acm device at all. Previously, I monitor it with macos console/log (forgot) for kernel/IO log, you may also want to try it out. Though the easiest way is hooking the usb analyzer to see if the control is actually sent via USB bus. When I have time, I will fire up my old macbook and try to capture its USB bus.

vocal harness
#

does tinyusb work on a raspberry pi 4?

fallow birchBOT
vocal harness
#

managed to fix that by symlinking aarch64-none-elf-gcc to gcc, now i'm getting

CC board.o
CC main.o
CC msc_disk.o
CC usb_descriptors.o
CC tusb.o
CC tusb_fifo.o
CC usbd.o
CC usbd_control.o
CC audio_device.o
CC cdc_device.o
CC dfu_device.o
CC dfu_rt_device.o
CC hid_device.o
CC midi_device.o
CC msc_device.o
CC ecm_rndis_device.o
CC ncm_device.o
CC usbtmc_device.o
CC video_device.o
CC vendor_device.o
LINK _build/raspberrypi_cm4/cdc_msc.elf
/usr/bin/ld: cannot find -lnosys
collect2: error: ld returned 1 exit status
make: *** [../../rules.mk:172: _build/raspberrypi_cm4/cdc_msc.elf] Error 1
robust walrus
vocal harness
robust walrus
#

I don't know what the skylanders thing does but you likely don't need a pi 4 to change how it works

vocal harness
#

instead of using the lcd/buttons, i want to make a touch screen interface for it

robust walrus
fallow birchBOT
vocal harness
#

I'm looking to be able to click and swipe. Similar to behavior my son already knows from his tablet. I really don't think the Pico is going to have the power for everything I want to do. At least not be able to do it smoothly.

#

There are a couple of different character types. I want to be able to have a smooth graphical interface for displaying their categories. When he clicks on an icon for a category, I want them to be able to swipe up and down between the characters available in that category. There will also be a back button to go back to the category selection screen.

#

My first thought was to just use the Pico and connect to it over a serial connection to give a commands. Then I read the pi 4 can act as a USB device and that seemed like the easier path. It's starting to feel like my over engineered serial communication will be easier

robust walrus
#

you might be surprised how fast the pico is

vocal harness
#

I did look into it. I was also looking at another chip I can't remember what it was that was slightly more powerful. Still not enough to do everything I want to.

fallow birchBOT
fallow birchBOT
fallow birchBOT
#

I have a solution yes, I'm just not sure how this could be included in tinyusb.

You can find the code here for a sort of "generic driver"
https://github.com/bjonnh/dinoctopus/tree/main/lib/usbmidi

I'm using the AdaFruit library and I'm storing the cable number.

This is how I use it:
https://github.com/bjonnh/dinoctopus/blob/main/src/pico/midi/midirouter.cpp

I'm just not sure yet how to include that properly in tiny usb.

fallow birchBOT
fallow birchBOT
#

I did USB-MIDI for SiLabs EFM8UB and EFM32GG, using the SiLabs USB stack, and I ported it to TI Tiva. This was before I learned of TinyUSB.

The issue, I think, is that so much of what a MIDI thing (controller, sample playback device, whatever) does is application dependent. This leaves the use of things like Cable Numbers entirely undefined at the protocol level. It is up to the application to look at the (if MIDI In) incoming packet and decide if the Cable Number, the Channel, and even th...

slow hinge
#

Does pio usb on the pico work as a pass through? Mitm kind of thing and is there any examples that do this?

robust walrus
fallow birchBOT
#

I looked at making the two function calls in tinyusb work as the API defines them. If we keep the USB MIDI receive FIFO structure the same, the tud_midi_n_available() function requires peaking at the packets in the USB receive FIFO without pulling data and counting the number of packets that match the specified cable number. The tud_midi_n_stream_read() function would require pulling only those packets from the specified cable out of the receive FIFO, which is possible but complicated. An...

fallow birchBOT
fallow birchBOT
fallow birchBOT
#

I don't have an opinion on this, I just followed what's already in _hw_endpoint_buffer_control_update32 in rp2040_usb.c. That was written by @kilograham I believe. I don't know if it makes any difference. If you want NOPs tell me if you want 6 or 12 of them as existing code delays for 12 cycles and a single NOP is 1 cycle (I think). This should only make a difference on massively overclocked chips as 3 cycles should be enough at 133MHz.

fallow birchBOT
fallow birchBOT
fallow birchBOT
#
[hathach/tinyusb] New branch created: add\-cmake\-build
fallow birchBOT
#

Discussed in https://github.com/hathach/tinyusb/discussions/2034

Originally posted by Jubatian April 19, 2023
Hi,

Would like to ask about the behaviour of tud_msc_read10_cb() in a scenario which seems to not work like I was expecting.

I have a relatively slow data source (an SPI Flash chip).

The existing architecture (with a different USB library I am migrating from), when a read request arrives from USB, calls a callback to notify the Data Source module that it n...

#

yeah, I think you are right about this. The way the msc driver is doing is queuing its self back using the same usbd event queue. Since tud_task() trying to process all the event before return. This cause an loop() without giving back the cpu. I think we could fix this by adding custom field for tud_task() to skip it until next time or so.

PS: I made an issue based on this discussion, since it is indeed an bug. Let move discussion there, thanks.

_Originally posted by @hathach in https:/...

fallow birchBOT
#

still haven't decided which is best way to do this, but I may follow the approach using by FreeRTOS-kernel https://github.com/FreeRTOS/FreeRTOS-Kernel/blob/main/CMakeLists.txt which also requires an external file config I.e adding CMakelists.txt that define tinyusb as a lib but requires an target that expose tusb_config.h in the include path. Pico-sdk can define both no os and freertos config, and one that does not speciy the freertos config in the library link will use the no os one. Let me ...

fallow birchBOT
fallow birchBOT
#
[hathach/tinyusb] New branch created: update\-imxrt\-deps
fallow birchBOT
fallow birchBOT
#

Operating System

Linux

Board

pico

Firmware

cdc_msc example with CFG_TUD_CDC_EP_BUFSIZE = 256

What happened ?

send 256bytes, with exact 64 bytes each. DCD won't notify tinyusb until all 256 bytes are received even there is a huge delay between each 64-byte packet.

How to reproduce ?

run following script on PC

from serial import Serial

serial = Serial('COM5', baudrate=4_000_000)

serial.write(b'\x46'*64) 
print(serial.readline())

D...

fallow birchBOT
fallow birchBOT
fallow birchBOT
fallow birchBOT
fallow birchBOT
#
[hathach/tinyusb] New branch created: add\-usb2uart\-host\-driver
fallow birchBOT
#
[hathach/tinyusb] New branch created: fix\-nxp\-build
fallow birchBOT
fallow birchBOT
#

Describe the PR
Add host serial driver for vendor chip, implement #1991 support

  • FTDI: need CFG_TUH_CDC_FTDI
  • CP210x: need CFG_TUH_CDC_CP210X

Although FTDI and CP210x are not part of CDC class, it is defined as subclass to only to re-use CDC driver API. And these serial driver work as if it is a subclass of CDC, occupies an CDC interfaces with the same API for application simplicity/convenience.

fallow birchBOT
#

While calling tud_cdc_n_get_line_coding, the structure is copied into the destination.

Dump of assembler code for function tud_cdc_n_get_line_coding:
0x000193f4 : mov.w r2, #2112 @ 0x840
0x000193f8 : ldr r3, [pc, #20] @ (0x19410
)
0x000193fa : mla r0, r2, r0, r3
=> 0x000193fe : ldr.w r3, [r0, #6]
0x00019402 : str r3, [r1, #0]

On some platform (tested on LPC55S28), the address needs to be 4-bytes aligned. Without this, the address is

(gdb) p &_cdcd_itf.line_coding
$3 =...

fallow birchBOT
fallow birchBOT
#

Operating System

Windows 11

Board

Custom board with STM32H753

Firmware

Custom firmware with a combination of uac-headset and 2 cdc serial ports

What happened ?

The symptom is that the interrupt handler sometimes ends up in a neverending loop. This occurs because the TX-fifo-empty interrupts fires. This happens by default when the fifo is half-empty. The interrupt-handler only wants to write a full packet. If it doesn't fir, nothing happens and the interrupt fires again....

fallow birchBOT
#
[hathach/tinyusb] New branch created: improve\-serial\-host
fallow birchBOT
#

Describe the PR
Due to the upcoming Arduino Portenta C33, we'd like to mainline some of the work we've been doing to support the Renesas RA6M5 HS port. The board support packages will come in a subsequent PR.

Most of the changes should be 100% backwards compatible, except the need for the user to explicitly specify CFG_TUSB_RHPORT0_MODE (if the FS port is going to be used) or CFG_TUSB_RHPORT1_MODE (for the HS port)

I didn't find any way to add this information in the board.mk ...

fallow birchBOT
fallow birchBOT
fallow birchBOT
fallow birchBOT
#

yeah, you are right, I think I will need to add _freertos to the library in the cmakelists.txt target. Another way to solve this is don't inline osal_ function, that allows to link to osal implementation later. However, I don't feel to go that approach since it requires too much changes for existing projects that use tinyusb. _freertos suffix target then, I am also slowly adding cmake target for tinyusb. Will continue to do that and make changes as needed regarding this PR.

#
[hathach/tinyusb] New branch created: cmake\-imxrt
fallow birchBOT
#

@dallaswood96 @hathach I am experiencing the same issue on Windows 10/11 + STM32G4. Reports sent by the host reach the device, and the device responds to the requests, tud_hid_report() returns success, but these responses (transfers Device -> Host) never reach the host. I am using libhidapi on the Host, and hid_read_timeout() always returns zero (timeout reached). I am completely stuck and have no idea how to proceed further. On Linux host everything works like a charm.

fallow birchBOT
fallow birchBOT
#

Related area

New port support

Hardware specification

efr32fg25

Is your feature request related to a problem?

Silicon Labs released their new Flex Gecko, efr32fg25. It is the first Flex Gecko with a USB peripheral.

Describe the solution you'd like

I would like to be able to work with the TinyUSB stack over the efr32fg25 device.

I have checked existing issues, dicussion and documentation

  • [X] I confirm I have checked existing issues, dicussion and documentation.
fallow birchBOT
fallow birchBOT
#

I have created an example USB MIDI device with 2 MIDI In and 6 MIDI Out here. The file midi_device_multistream.c contains an implementation of tud_midi_demux_stream_read() and
the example program uses it to de-multiplex the virtual cables received on the OUT endpoint and route them to the 6 DIN MIDI
Out jacks. I did not submit this as a pull request because midi_device_multistream.h has a set of helper macros for building
a USB d...

fallow birchBOT
fallow birchBOT
fallow birchBOT
fallow birchBOT
#
[hathach/tinyusb] New branch created: cmake\-lpc55
fallow birchBOT
fallow birchBOT
#

Without compiler optimization for GCC, I get 1.90MB/s throughput on vanilla code and 2.23 MB/s with 2048 byte buffer sizes.
When enabling optimization, it roughly doubles to 4.52 MB/s with the 2048 byte buffers.

Indeed these numbers are not good for HS transfer...

I thank it's from both hardware & software.

The Synopsis DWC2 IP inside STM32F4 is less capable than Chipidea HS inside LPC43XX. Chipidea one has embedded DMA who can transfer multiple packets without CPU intervention or...

fallow birchBOT
#

Operating System

Windows 10

Board

RA family

Firmware

src/portable/renesas/rusb2/hcd_rusb2.c

Also in other places under the portable directory.

What happened ?

__builtin_ctz function is not supported by IAR intrinsic which is used in the following:
src/portable/renesas/rusb2/hcd_rusb2.c

I am not sure if it is available under a different name. However, I would like to hear your opinion regarding this.

Thank you.

How to reproduce ?

Just by compiling in ...

fallow birchBOT
#
[hathach/tinyusb] New branch created: imx\-usbhost
fallow birchBOT
#

Describe the PR

  • EHCI: fix xfer failed with disconnected device as stalled
  • change CFG_TUH_ENDPOINT_MAX to 16 (max endpoint pair per device) if
    not defined
  • change QHD_MAX for EHCI, should be user configurable and more
    optimized in the future
  • fix #1511 un-roll recursive hub removal with usbh queue. (not perfect but good enough)
  • usbd: fix control transfer issue for chipidea hs when previous status and new setup complete in the same isr frame
  • change usbd edpt busy/stalled/c...
fallow birchBOT
fallow birchBOT
fallow birchBOT
fallow birchBOT
#

I believe enabling DMA in the dcd_dwc2 driver would be beneficial for upping the transfer rates. Trying a throughput test with the standard ST middleware with DMA enabled I can get approximately 16MB/s throughput, as long as the data size is limited.

I'm afraid it will take me a considerable amount of time to get that working. Given the throughput rates you are reporting, I am considering using an NXP MCU in the future though ^^

fallow birchBOT
fallow birchBOT
fallow birchBOT
fallow birchBOT
fallow birchBOT
#

Just started to look at this more in-depth to understand what is happening.

Do I see the followings right?

  • The queue is read here: https://github.com/hathach/tinyusb/blob/master/src/device/usbd.c#L487
  • In case of having an RTOS, the while() loop here is meant to practically never exit, relying on osal_queue_receive() yielding whenever the queue becomes empty for optimal scheduling.
  • In case of no RTOS, an empty queue results in osal_queue_receive() returning false, thus exiting, p...
fallow birchBOT
fallow birchBOT
fallow birchBOT
#

Operating System

Linux

Board

Raspi Pico RP2040

Firmware

My probe project (https://github.com/rgrr/yapicoprobe/tree/feature/systemview-rndis) uses lwIP / TinyUSB to provide a network interface for SystemView (https://www.segger.com/products/development-tools/systemview/).

The probe is running on a Pico (RP2040), the connected target board is an nRF52840. The nRF52840 generates the SystemView events (https://github.com/rgrr/playground/tree/feature/xray/tools/SystemView), th...

fallow birchBOT
fallow birchBOT
#
[hathach/tinyusb] New branch created: minor\-build\-system
#

Maybe a better, but possibly more elaborate idea for a probable solution:

  • Add another special return, for example defined to INT32_MAX, for the possible returns of tud_msc_read10_cb(). This return would indicate that the availability of data will be signalled (while 0 would retain its current behaviour for compatibility). In proc_read10_cmd(), this special value would result in doing nothing (as compared to sending the zero length dcd_event_xfer_complete() for the 0 return).
  • Add a sig...
fallow birchBOT
fallow birchBOT
#

Hi @facchinm & @hathach

I have also tested this on USBFS RA6M5, It was working fine but sometimes It just gets stuck in below
condition due to hitting break point.

under function usbh_edpt_xfer_with_callback()

// Attempt to transfer on a busy endpoint, sound like an race condition !
line - TU_ASSERT(ep_state->busy == 0);

Any Idea what could be the reason or how could be be handled? any hints?

fallow birchBOT
#

Improved HFCLK management for nRF5x with weak functions, the user can override and implement it's own HFCLK management, when other peripherials, such as Radio needs it.

Usage
User can override those functions:
void dcd_enable_hfclk(void); - called, when dcd requests HFCLK activation
void dcd_disable_hfclk(void); - called, when dcd requests HFCLK deactivation

If the functions are not overridden, HFCLK will be activated and deactivated by TinyUSB.

#

Related area

device controller driver

Hardware specification

nRF5x

Is your feature request related to a problem?

When SoftDevice is not present or is disabled, HFCLK activation/deactivation is managed by TinyUSB. This can cause problems, when other peripherials, such as Radio, needs HFCLK to run properly.

Describe the solution you'd like

I have improved HFCLK management for nRF5x with weak functions, the user can override and implement it's own HFCLK management, when ot...

fallow birchBOT
fallow birchBOT
fallow birchBOT
#

Operating System

Windows 10

Board

Custom STM32H747BGT6

Firmware

Custom firmware with use of TinyUSB lib. Affected file: src/portable/synopsys/dwc2/dcd_dwc2.c

What happened ?

dcd_dwc2.c - function reset_core() halts in infinite loop after restart or power up of MCU. It happens at random times.

Present code:
static void reset_core(dwc2_regs_t * dwc2)
{
// reset core
dwc2->grstctl |= GRSTCTL_CSRST;

// wait for reset bit is cleared
// TODO version 4.20a s...

fallow birchBOT
fallow birchBOT
#

Yes, I am using the -e flag, for IAR workbench users it is under :
Options/ C_C++ compiler/ Language 1 / Language conformance / Standard with IAR extensions

I have the same question regarding TU_ATTR_PACKED, I thought it should be enough. However, I am using IAR compiler 9.1, which seems insufficient for these structs. When I use the __packed I am getting rid of the warnings. Here is IAR warning that I am getting:
![iar_warn](https://github.com/hathach/tinyusb/assets/36272850/bb654681-dd...

fallow birchBOT
#
[hathach/tinyusb] New branch created: ehance\-chipidea
fallow birchBOT
fallow birchBOT
#

Related area

driver

Hardware specification

esp32s3

Is your feature request related to a problem?

I have created 1 USB mass storage according to the example, I copy 1 file test.txt into that USB drive. then how can i use esp32 to read the data inside that txt file and show it to serial debug

Describe the solution you'd like

using fread, fwrite

I have checked existing issues, dicussion and documentation

  • [X] I confirm I have checked existing issues, dicussion and ...
fallow birchBOT
fallow birchBOT
#

update: I just ordered an rtthread HMI board https://www.cnx-software.com/2023/05/17/25-renesas-hmi-board-features-ra6m3-microcontroller-for-rt-thread-lvgl-development/ . It is a pre-order with a reasonable price (25$) + 4$ shipping. Athough it is RA 6M3 but also have HS USB as 6M5. They will start shipping from June 5, it is probably better to wait for the board so that I could actually do the testing with the HW. Of course, unless @facchinm would prefer to have it merged first. Let me know ...

fallow birchBOT
#

This is a daughter PR from PR#2063

I am using the -e flag, for IAR workbench users it is under :
Options/ C_C++ compiler/ Language 1 / Language conformance / Standard with IAR extensions

TU_ATTR_PACKED is not solving the compiler warnings, I thought it should be enough. However, I am using IAR compiler 9.1, which seems insufficient for these structs. When I use the __packed I am getting rid of the warnings

Here is an example given by IAR, which somehow makes it seems that only __pac...

fallow birchBOT
fallow birchBOT
#

Thanks for the response @hathach ,

will open the bug with more information, I also have one more issue with this port.

It will be great if you could guide me in understanding if it is actually the issue or not that before I open the issue.

Issue :- While sending the first command from msch_xfer_cb - case MSC_STAGE_CMD :- I am getting the stall response. and receiving the NRDY interrupt status.

This happens when I running the code on IAR, where as in e2studio with same code I don't...

fallow birchBOT
fallow birchBOT
fallow birchBOT
#
[hathach/tinyusb] New branch created: more\-build\-system
fallow birchBOT
#

@HiFiPhile The workaround is suppressing the warnings, but sometimes you can not use it, for example:
return ((volatile uint16_t*)(RUSB2)+ offsetof(RUSB2_REG_t,PIPE_CTR[num - 1]));
here it is throwing an error because "num" is not a constant. __packed suppress all the warnings, I have tested it, seems to work, I am not sure if we can use the following :
#define TU_ATTR_PACKED __packed
instead of:
#define TU_ATTR_PACKED attribute ((packed))
for the IAR...

fallow birchBOT
#

I'm agreed IAR has some problem handling packed struct, behavior of __attribute__ ((packed)) and __packed should be the same, either:

  • Emit warning for all packed struct
  • Smart enough to know that address is in fact aligned

Could you try to change packed keyword into bitfields level, such as:

typedef struct {
  union {
    volatile uint16_t E; /* (@ 0x00000000) Pipe Transaction Counter Enable Register */

    struct TU_ATTR_PACKED {
      uint16_t : 8;
      volatile ...
fallow birchBOT
fallow birchBOT
#
[hathach/tinyusb] New branch created: more\-build2
fallow birchBOT
fallow birchBOT
#

Didn't check the host, though I think it might not be a problem there as the host is driving the communication. On the device side, the problem manifests due to the host asking for data (without prior notice to prepare it), which needs to be served (which may take time to prepare, requiring the work of other modules).

I applied a patch locally, following my second suggestion of adding an interface to signal data readiness. It took just a few dozens of lines in the MSC device class (header ...

fallow birchBOT
#

Operating System

MacOS

Board

Raspberry Pi Pico

Firmware

Based on UAC2 headset example, extended to have 2 UAC2_Headset devices
The headset example works as expected.

What happened ?

I have two UAC2 devices running.

  • A device called 'L' acts as a microphone, sending data from an electret microphone (using the RPi microphone library)
    up to the Mac.
  • The Mac runs sox, consuming the mic data and sending it to a wav file. Note the Mac is not outputting to either of th...
fallow birchBOT
fallow birchBOT
fallow birchBOT
fallow birchBOT
#

In my test there is no more warning moving TU_ATTR_PACKED to the bitfield struct level. image

Yeah, we should move the packed to bitfield if that fixes the issue. And also having TU_VERIFY_STATIC() to make sure the size of the whole struct is correct as well.

But since RUSB2_REG_t heavily use bitfield, I feel like adding TU_ATTR_PACKED everywhere is not elegant.

I don't real...

fallow birchBOT
fallow birchBOT
fallow birchBOT
#

After #2016 merged, I'm getting Data Seq Error when LOG=3 which is the same error when LOG=0. So at least it is consistent.
Here are the logs when I power up with the hub already plugged in:
usb-hub-setup.txt

and then after I plug in the B100 Logitech mouse into the hub:
(ignore ALL: Resetting devices lines, as that is part of my code)

[usb-hub-connect-mouse.txt](https://github.com/hathach/tinyusb/files/1160284...

fallow birchBOT
#

Discussed in https://github.com/hathach/tinyusb/discussions/2078

Originally posted by Commotari May 24, 2023
in function tud_hid_n_report the length is getting limited according the bufferlength "CFG_TUD_HID_EP_BUFSIZE" that is configured in tusb_config.h.
if using the function with bigger package lengths of course it does not work. but also it does not tell that anything went wrong.
it just sends the package out with a limited length and returns success.
on my windows appl...

fallow birchBOT
#
[hathach/tinyusb] New branch created: minor\-cleanup
fallow birchBOT
#

thank you @HubertD very much for this brilliant port, and @HiFiPhile for improving/enhancing and testing with actual hardware. I have pull and tested this on my https://www.st.com/en/evaluation-tools/nucleo-g0b1re.html . The driver works great, USB enumerates and works as it should be.

However I have to changes the clock setup to use HSI48 (on B1) for USB device to run (existing code doesn't work with B1). @HiFiPhile maybe we should seperate the B0 to its own board, since it seems to lack...

fallow birchBOT
#

However I have to changes the clock setup to use HSI48 (on B1) for USB device to run (existing code doesn't work with B1).

It must be because of this (I don't even remember when I soldered SB17), since B0 doesn't have CRS HSE must used.

image

Maybe no need to separate B0 board, just put a word to solder SB17 for B0 user.

Let me know if you are still planning to update this PR more, and p...

fallow birchBOT
#

yeah, ST doesnt make nucleo B0 version, you probably the only one that would rework the chip and solder the SB17. That is amazing soldering skill, I struggle enough with only soldering SWD occacsionally :D . I will keep the clock and also added the note for B0, at least that would give you an easy way to modify the code to test with your board. I am trying to add USB PD support, therefore want to get G0/G4 up to date before doing more works to prevent conflict in the future.

fallow birchBOT
#

In fact my job title is more like a hardware guy ;) Sometimes I even need to re-plant solder balls of eMMC chip :D

That sounds like awesome (awful) job to me :smile:

You mean the whole PD stack ? Seems a lot job to do.

yeah, I went through the specs recently, it is lots of works. But i will try to get the PD sink work first, to at least request an vbus = 12v or 20v first with PD controller on G0/G4 then try to bit-bang it with rp2040 (gpio or pio). That is a long way to go.

fallow birchBOT
fallow birchBOT
#

Discussed in https://github.com/hathach/tinyusb/discussions/2083

Originally posted by mkarliner May 26, 2023

Operating System

MacOS

Board

Raspberry Pi Pico

Firmware

Based on UAC2 headset example, extended to have 2 UAC2_Headset devices
The headset example works as expected.

What happened ?

I have two UAC2 devices running.

  • A device called 'L' acts as a microphone, sending data from an electret microphone (using the RPi microphone library...
fallow birchBOT
fallow birchBOT
#

I think this is one of those good new / bad news situations...

Good news:
I got it working and of course in the end adapting my code was easy (after spending a few hours searching for the little difference in my descriptors that prevented it from working immediately). So, I think the pull request is good.

Bad news:
I did not manage to achieve a significantly higher frame rate. In contrast to the isochronous mode the UVC driver accepts a 30fps stream in bulk transfer mode, but when I r...

fallow birchBOT
#
[hathach/tinyusb] New branch created: stm32g4
fallow birchBOT
fallow birchBOT
fallow birchBOT
fallow birchBOT
fallow birchBOT
fallow birchBOT
#
[hathach/tinyusb] New branch created: g4\-pd
fallow birchBOT
#

Describe the PR
This PR moves helper macros from tusb_common.h to separate file so it can be included from tusb_types.h.
This is needed for situations when user needs to include only types without the rest of the stack.
It is useful mainly for writing libraries using TinyUSB as a dependency.
Curently there is no way to import only types from a library without having a stack set up.

Additional context
I am writing a small [library](https://github.com/tomas-pecserke/pico_tus...

fallow birchBOT
fallow birchBOT
fallow birchBOT
fallow birchBOT
fallow birchBOT
fallow birchBOT
#

look good, though can we still keep the TU_ATTR_PACKED of the overall struct? is this just to prevent any padding between sub-struct member?

For some reason, the compiler will keep the warnings, if I do that. This is why I have removed them

I see, what I interperte is the bit-field struct is packed -> size = 2, however, since the global struct is not packed, it is techically valid if compiler inserted padding between 2 struct/union e.g to have each 4-byte aligned. Since the glob...

fallow birchBOT
#

look good, though can we still keep the TU_ATTR_PACKED of the overall struct? is this just to prevent any padding between sub-struct member?

For some reason, the compiler will keep the warnings, if I do that. This is why I have removed them

I see, what I interperte is the bit-field struct is packed -> size = 2, however, since the global struct is not packed, it is techically valid if compiler inserted padding between 2 struct/union e.g to have each 4-byte aligned...

fallow birchBOT
fallow birchBOT
fallow birchBOT
fallow birchBOT
fallow birchBOT
fallow birchBOT
fallow birchBOT
fallow birchBOT
#

should be no issue, though I found that for cmake, we don't need TOP to be absolute path as with makefile. Do pi example requires TOP to be absolute to build ?

Well you changed TOP from ${CMAKE_CURRENT_LIST_DIR}/../../.. to ${CMAKE_CURRENT_LIST_DIR}/../.. when you moved it to the parent family_support.cmake.

All the uses are a directory deeper ${TOP}/some_file whic no longer matches up. I figured if you wanted TOP to be usable anywhere in that sub-tree I'd make it absolute. ...

fallow birchBOT
fallow birchBOT
#

Update: The rp2040 zero issues seem to be separate (seems like they don't boot fullstop after disconnecting); the issue with tiny_usb devices not showing on the steno board persist though; and are intermittent.. most times it doesn't work; but when connecting to a sleeping machine, it seems to be able to wake it up most of the time, then work correctly after.

I am sorry to bother you but I got the same problem with you, I have 3 RP2040-Zero from WaveShare, only 1 works, the other...

fallow birchBOT
fallow birchBOT
fallow birchBOT
#

Describe the PR
Initial support for USB PD stack tested with STM32 G4. Able to communicate via CC channel to:

  • retrieve Source Capabilities from a charger

    PD Source Capabilities
    [Fixed] 5000 mV 3000 mA
    [Fixed] 9000 mV 3000 mA
    [Fixed] 15000 mV 2000 mA
    [Fixed] 20000 mV 1500 mA

  • Able to request power to supply 5v, 9V and 15V (which is maximum B-G474E-DPOW1 can withstand).

  • Although possible, this PR didn't tested USB communication along with PD.

  • API is all very ...

fallow birchBOT
fallow birchBOT
#

Purpose: This example provides a composite CDC + UAC2 device on top of a Raspberry Pi Pico board.

Closes: https://github.com/hathach/tinyusb/pull/1717

Motivation:

The CDC + UAC2 composite device happens to be important, especially in the amateur radio community.

Modern radios (rigs) like Icom IC-7300 + IC-705 expose a sound card and a serial device (composite device) to the computer over a single USB cable. This allows for Audio I/O and CAT control over a single USB cable whic...

fallow birchBOT
fallow birchBOT
#

wow you are super fast smile

I am only scratching the surface, PD defines lots more message, also allow swapping data role, effectively making OTG obsolete. Anyway, this only allow device to request higher operating voltage, which is handy and probably most user want to have higher VBUS with typec charger (finally get rid of the DC Jack). There is still lots more works.

fallow birchBOT
fallow birchBOT
#
[hathach/tinyusb] New branch created: fix\-usbh\-enum\-issue
fallow birchBOT
fallow birchBOT
#
[hathach/tinyusb] New branch created: typec\-rename
fallow birchBOT
#
[hathach/tinyusb] New branch created: chipidea\-fs
#

Describe the PR

  • ChipIdea Fullspeed is used by various mcus such as kinetis, mm32, pic32. This PR refactor to move driver from khci to chipidea fullspeed to make it easier to merge/port new chip with this controller.
  • update kl25z to use mcux-sdk since the chip now available in the repo.
fallow birchBOT
fallow birchBOT
fallow birchBOT
fallow birchBOT
#
[hathach/tinyusb] New branch created: minor\-naming\-opt\-mcu\-imxrt
#

About that rate: I did not test with a minimal project, but I suspect that this is an issue particular to my project as the rp2040 has quite a lot to do in that case and probably misses a few chances to transmit data when tud_task is not called in time. I am currently working on a method to achieve 60fps via MJPEG encoding (thanks to a very clever idea someone suggested to me) and I am having the exact same problem: I managed to encode 160x144 JPEGs at 60fps, but I have not yet succeeded to...

fallow birchBOT
fallow birchBOT
fallow birchBOT
#
[hathach/tinyusb] New branch created: correct\-iar\-build
fallow birchBOT
#

Operating System

Windows 10

Board

stm32f401blackpill

Firmware

Custom firmware STM32Arduino and Platformio based.
Main contains the additional required code to set he GPIO pinmux, and VSENSE is disabled via:

#include 
#include "tusb.h"

// Pinmux for USB not exposed by core variants !
const PinMap PinMap_USB_OTG_FS[] = {
    {PA_11, USB_OTG_FS, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF10_OTG_FS)}, // USB_OTG_FS_DM
    {PA_12, USB_OTG_FS, STM_PIN_DATA(STM_...
fallow birchBOT
fallow birchBOT
fallow birchBOT
#

Describe the PR

I tested using picosdk/lib/tinyusb/examples/host/bare_api almost as is for communication with Dynastream ANT-USB-m in a rp2040 /pico-w environment and found that incorrect memory access is occurring during the debugging device information output process.

I believe this is due to some misconfiguration and are still analyzing the problem, but I have added a check for cases where the result of tuh_descriptor_get_manufacturer_string_sync is not retrieved to prevent illeg...

fallow birchBOT
fallow birchBOT
#
[hathach/tinyusb] New branch created: etm_trace
fallow birchBOT
#

Describe the PR
Add etm trace for supported boards:

  • nrf52840, nrf5340
  • mcb1857, when etm trace is enabled, cpu clock reduce from 180mh to 120mhz (max trace clock is 60mhz)
  • stm33h743 eval: when etm trace is enabled, cpu clock reduce from 400mhz to 150mhz. (Max trace clock is 50 mhz)
fallow birchBOT
fallow birchBOT
#

[HOST] Quit the joystick test app.
[HOST] Run the HID test app.

There is nothing tinyusb lib can do to fix this scenario, the report is delivered to PC host. Host decides not to forward past event to test app or test app simply does not query those events is out of each for a usb device. You can mix both approach by having an periodic timer with reasonably large enough timer

fallow birchBOT
#

[HOST] Quit the joystick test app.
[HOST] Run the HID test app.

There is nothing tinyusb lib can do to fix this scenario, the report is delivered to PC host. Host decides not to forward past event to test app or test app simply does not query those events is out of each for a usb device. You can mix both approach by having an periodic timer with reasonably large enough timer

Good to know - thank you for your insight on this matter, much appreciated.

fallow birchBOT
#

This fixes the handling of HID input and output interrupt reports in tinyusb, which are currently conflicting with get feature and set feature reports.

HID supports "get feature" and "set feature" reports over ep0 (control endpoint).
HID also supports "input" and "output" reports over endpoints specified in the hid interface section of the configuration descriptor.

Currently tinyusb uses the same buffer 'epin_buf' for output reports and get feature reports.
It also uses the same buffe...

fallow birchBOT
fallow birchBOT
fallow birchBOT
fallow birchBOT
#
[hathach/tinyusb] New branch created: refactor-make-build
fallow birchBOT
#

Operating System

Windows 10

Board

imxRT1024 custom (USB same as EVK board)

Firmware

tinyUSB main as of noon EST 24-June-2023.

arm-none-eabi-g++ (GNU Arm Embedded Toolchain 10.3-2021.10) 10.3.1 20210824 (release)
Copyright (C) 2020 Free Software Foundation, Inc.

Application is essentially msc_file_explorer example (FreeRTOS).

What happened ?

If the application is started with the USB stick already plugged in, it works fine.

A MassStorage device is mounted
D...
fallow birchBOT
fallow birchBOT
fallow birchBOT
#
[hathach/tinyusb] New branch created: cmake-detect-family
fallow birchBOT
#
[hathach/tinyusb] New branch created: rp2040-cmake-cleanup
fallow birchBOT
#

Thank you for your comment,
I had tried following debug in a rp2040 /pico-w environment.

And I am currently working on an implementation without using the tuh_descriptor_get_manufacturer_string function.

Thread 1 hit Breakpoint 1, tuh_descriptor_get_manufacturer_string_sync (daddr=daddr@entry=1 '\001', language_id=language_id@entry=1033, 
    buffer=buffer@entry=0x20041e48, len=len@entry=256) at /home/dsugisawa/git/pico-sdk/lib/tinyusb/src/host/usbh.c:1081
1081	{
(gdb) c
Co...
fallow birchBOT
#
[hathach/tinyusb] New branch created: cmake-freertos
fallow birchBOT
#

Thank you for making PR, after doing quite a bit of works to support cmake, I am getting better with it. I agree that adding tinyusb_device_freertos and tinyusb_host_freertos is best approach. Though I think we should do it in pico-sdk, I also think the freertos-kernel lib should be also added there rather than within tinyusb. That will help pico user by just simply link with freertos-kernel and or tinyusb_device_freertos. Check out my PR to pico-sdk here https://github.com/raspberrypi/pico-s...

fallow birchBOT
#

New evidence for the NCM problem.

I have done some tests with the iperf server provided in the lwIP examples and recorded with Wireshark.

Once I have done the tests with ECM and once with NCM. iperf command line on client side (Linux) is

for MSS in 90 93 100 150 200 255 256 300 400 500 511 512 600 700 800 900 1000 1100 1200 1300 1400 1450 1459 1460 1500; do iperf -c 192.168.14.1 -e -i 1 -l 22 -M $MSS; sleep 10; done

Wiresharks statistics graphs are as follows.

Good case is ...

fallow birchBOT
fallow birchBOT
fallow birchBOT
fallow birchBOT
#

Hi, any update on this ? we're ready to merge support for the new board in MicroPython but it's blocked by this (see micropython/micropython#11405). Are there any standard tests that we can maybe run for you instead ?

I am still waiting for my 6m5 dev kit, it is probably delivered in a day or two. Then we could start reviewing & testing, if everything go well, we could merge this mid-next week or so.

fallow birchBOT
fallow birchBOT
fallow birchBOT
fallow birchBOT
#
[hathach/tinyusb] New branch created: hcd-frame-pio-usb
fallow birchBOT
#

Hmmm, does anybody read this?

I want to make a proposal: the ncm_device driver seems to be very buggy, e.g. it operates on incoming frames while the previous one is still processed, also it does no ZLP insertion where it should insert one. These bugs are the cause for the above described hickups.

I have implemented a simple version of the driver, which allows only one ethernet frame on reception/transmission.

This would put the focus on reliability, not so much on performance.

If...