-
Notifications
You must be signed in to change notification settings - Fork 1.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Renesas ra hs rebased from #2052 #2192
Conversation
Should fix CI failure for Renesas RX family
__CCRX__ only applyes to version 4 of RX family compiler http://tool-support.renesas.com/autoupdate/support/onlinehelp/csp/V4.01.00/CS+.chm/Compiler-CCRX.chm/Output/ccrx04c0201y.html __RX__ is one of the macros exported by latest gcc (gcc_8.3.0.202305_rx_elf)
Update fsp to 4.0.0
Since CFG_TUSB_RHPORT1_MODE is always defined now for backwards compatibility
…lowering PLL to 128Mhz.
- make osal_task_delay() as weak function in usbh - implement osal_task_delay() in hcd rusb2 (may moved to other places)
Sure thing! I'm testing it right now inside the core with our test suite 🙂
I agree that this in not to be part of the actual driver but a configuration at board level, so we'll add the call in the core |
volatile uint8_t *ff8; | ||
|
||
// Highspeed FIFO is 32-bit | ||
if ( rusb2_is_highspeed_reg(rusb) ) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
HS FIFO is 32-bit but its addressing is a bit odd. Strangely this isn't needd for host driver. In the future we should use 32-bit mode for HS since it is faster.
oh really, let me test it out, maybe there is an BSP macro that give out the hint and we could use that. Let me double check Update: wowla it works like a charm, I totall miss this. In my defense, I am not a really good hw :D. This seems to be indeed hw decision sinnce this requires schematics changes to pin VCC_USB_LDO. I have updated the example to enable this specifically for UNO R4 after tud_init(). |
This is no longer working for MicroPython/RA6M5 (the device just doesn't enumerate) is the following config still valid ?
|
add BOARD_UPPERCASE for board detection
Let me pull out the micropython/micropython#11405 to test with, may need some time since I am not familliar with building mp. Meanwhile I think you could just use
CFG_TUSB_RHPORT0/1_MODE can be actually dropped now, but let me double check |
I tried a few different things but none of them seemed to work. To build the board just:
Double tap to enter the bootloader , flash and reset:
|
added portenta_c33 to tinyub's bsp. Example works well, maybe it is mp configure. Pulling to test ... |
@iabdalkader just pull and tested, you need update to correctly pass rhport to interrupt handler (1 instead of 0). It previously works, since the device stack is fixed to either port0 or port1 with CFG_TUSB_RHPORT0/1_MODE, but this rebased update to get it work dynnamically. void usbhs_interrupt_handler(void) {
IRQn_Type irq = R_FSP_CurrentIrqGet();
R_BSP_IrqStatusClear(irq);
#if CFG_TUSB_RHPORT1_MODE & OPT_MODE_HOST
tuh_int_handler(1);
#endif
#if CFG_TUSB_RHPORT1_MODE & OPT_MODE_DEVICE
tud_int_handler(1);
#endif
}
void usbhs_d0fifo_handler(void) {
IRQn_Type irq = R_FSP_CurrentIrqGet();
R_BSP_IrqStatusClear(irq);
#if CFG_TUSB_RHPORT1_MODE & OPT_MODE_HOST
tuh_int_handler(1);
#endif
#if CFG_TUSB_RHPORT1_MODE & OPT_MODE_DEVICE
tud_int_handler(1);
#endif
}
void usbhs_d1fifo_handler(void) {
IRQn_Type irq = R_FSP_CurrentIrqGet();
R_BSP_IrqStatusClear(irq);
#if CFG_TUSB_RHPORT1_MODE & OPT_MODE_HOST
tuh_int_handler(1);
#endif
#if CFG_TUSB_RHPORT1_MODE & OPT_MODE_DEVICE
tud_int_handler(1);
#endif
} You can also remove CFG_TUH_RHPORT/CFG_TUD_RHPORT since aren't part of the tinyusb configuration.
If you use |
- remove ra from ci make build since it is already in cmake ci
@hathach Thanks for the insight, it now works again!
Is there a way to know/query if a port is configured as host or device, if I use |
@hathach I spotted one issue in the dynamic IRQ handling; since EDIT: patch here arduino@965627e |
Meanwhile you could define CFG_TUD_RHPORT or MP_TUD_RHPORT etc.. macro or a variable to call correct int handler. Note: For renesas port USB FS is port0 and HS is port1. |
ah, you are right, hcd and dcd will have different copies of the controllers. I think we shoud add an common rusb2_common.c like rp2040 since both hcd and dcd seems to share quite a bit of code anyway. PS: just saw your patch, exactly like my thought, let me copy that over :) |
@facchinm I just realized we are doing the same thing in different PR 😄 . I merged your commits from 2052, but also add some additional changes:
|
@hathach I checked the host functionality without the "retry" logic and it works fine across all the carriers, patch for removal submitted here arduino@edee46e |
Perfect, thank you |
Describe the PR
Supersede #2052 (once this Pr is merged, the other will be marked as merged as well). Thank you @facchinm for original PR to add support for renesas highspeed USB. This PR rebased, merged with latest changes also add following changes to renesas port
PORT=0
. e.gmake BOARD=ra6m5_ek PORT=0
orcmake -DBOARD=ra6m5_ek -DPORT=0
Note: There is quite a bit of shared code between hcd and dcd for rusb2. We should refactor to have them in common files, but that can be saved for following-up PRs.
@facchinm I may miss a thing or two, please review and/or test this PR out if you have some time.