Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Renesas_RA: add support for board with HS USB port #2052

Merged
merged 45 commits into from
Aug 3, 2023

Conversation

facchinm
Copy link
Contributor

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 but I'm surely missing something, so any help is appreciated.

Additional context
/cc @iabdalkader for the Micropython port

@hathach
Copy link
Owner

hathach commented Apr 29, 2023

Superb! Thank you for your PR. I am on vacation, and will check this out afterwards (~7 days)

@mcuenthusiast
Copy link

Hi facchinm,

Thanks for the PR.

Is Host tested on RA6M5 with Highspeed module? I would like to take the reference for the same.

@facchinm
Copy link
Contributor Author

@mcuenthusiast yes, the HS port has been tested in host mode too 🙂

@mcuenthusiast
Copy link

Thanks @facchinm for quick response

Should fix CI failure for Renesas RX family
@hathach
Copy link
Owner

hathach commented May 19, 2023

Hi sorry for late response, this is still on my radar. I was trying to get an RA6M5 EK to test with. However, that would probably takes too long (since I still couldn't decide what other stuffs to bundle with). I will review this in the next couple of days and test it on the hardware later on.

@mcuenthusiast
Copy link

mcuenthusiast commented May 19, 2023

Hi @facchinm & @hathach

I have also tested this on Host USBFS on RA6M5(MSC file explorer example), 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?

@hathach
Copy link
Owner

hathach commented May 24, 2023

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 if it is blocking your any of work. Thank you for your patient.

@mcuenthusiast rusb2 is a new port, It wouldn't be supprise to have bugs. I don't actually done much work/testing with it yet, and yes race condition can happen since it is the most occurred bug so far. Feel free to open an issue with detail of the bug so that we could fix it later

@mcuenthusiast
Copy link

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 have problem.

I just want to understand if this could be any compiler dependent issue or integration issue?

@hathach
Copy link
Owner

hathach commented May 25, 2023

@mcuenthusiast just open a new issue, we could discuss there.

@facchinm
Copy link
Contributor Author

@mcuenthusiast in fact I've been only testing the patch on e2studio (gcc)

__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)
Since CFG_TUSB_RHPORT1_MODE is always defined now for backwards compatibility
@facchinm
Copy link
Contributor Author

facchinm commented Jun 9, 2023

@hathach is there anything I can do to speedup the merge 🙂 ?

@hathach
Copy link
Owner

hathach commented Jun 10, 2023

@facchinm you have done wonderful works. Though since I am still waiting for rt-thread to ship my order. I haven't looked at this pr changes yet. I have asked them about the shipment (ETA is June 5th). If it is blocking your works. We could review it first and do the hand-on tests later on. Sorry for the delay so far.

@facchinm
Copy link
Contributor Author

No worries, take your time 🙂 Thanks for the amazing work!

@hathach
Copy link
Owner

hathach commented Jun 12, 2023

good news, they already shipped my package, it will probably arrive in several days.

@hathach
Copy link
Owner

hathach commented Jun 23, 2023

update: package from rt-thread is still nowhere to be founnd. My exp with China ground postage is if it does not make it in a week or two, it will take a month or even two. I loose the patient and order an renesas 6m5 dev kit from digitkey, all thanks to Adafruit's sponsorship. Digikey has shipped my order, hopefully we could review/test/merge this next week.

@facchinm
Copy link
Contributor Author

Now that the product is available we can also send you a Portenta C33 (just drop me an email 😉 )

@hathach
Copy link
Owner

hathach commented Jun 23, 2023

Now that the product is available we can also send you a Portenta C33 (just drop me an email wink )

sound great, I would love to test out C33 as well. What is your email, though. I can't find it in your profile. If you don't want to state it public, you could send me an email first, Mine is in github profile

@hathach
Copy link
Owner

hathach commented Jul 18, 2023

still reviewing and testing this, already complete with dcd test/update. Will start to test apply changes to hcd as well soon, though I am switched to other work atm (be back as soon as I could). Meanwhile @facchinm if you have some time, please comment on the above questions.

@facchinm
Copy link
Contributor Author

Hi @hathach , sorry for disappearing but other releases + some vacation made my response running a bit late 🙂
I'm answering in line with the issues you raised; some of them were workarounds for peculiar behaviours we experienced and might not be needed after all. We are willing to adopt your rebased branch and continue development there while testing for regressions on our side.
In particular, usb host enumeration was problematic and lead to most of them, but probably can be solved more efficiently (or in the user application).
Let me know if it works for you!

@hathach
Copy link
Owner

hathach commented Jul 24, 2023

@facchinm no problem at all, everyone is busy. In addition, I saw lots of new boards from Arduino within a very short time. It must be very crazy time for you. I will wrap up the hcd for ra and then make an PR for your review/regression soon. Thank you for the awesome work :)

@hathach
Copy link
Owner

hathach commented Jul 31, 2023

I am finally able to wrap up the rebased/updated PR #2192 @facchinm @kkitayam If you could find some time, please review and test it out if possible. Thank you.

@hathach
Copy link
Owner

hathach commented Aug 1, 2023

Perfect, thank you for updating it here. @facchinm @iabdalkader let me know when you think this passes your test and good to merge. Meanwhile we should also wait for feedback from @kkitayam (original author of rusb driver)

@hathach hathach requested a review from kkitayam August 1, 2023 16:05
Copy link
Owner

@hathach hathach left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

perfect now, look good to me and ready to merge if everyone is happy.

@hathach
Copy link
Owner

hathach commented Aug 3, 2023

perfect, thank you everyone for joining to make this PR possible. I am glad we finally merge it. Any issues could be addressed later with follow-up PRs.

@hathach hathach merged commit 6d03bb9 into hathach:master Aug 3, 2023
41 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants