-
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
Add port for Analog Devices MAX32 MCUs #2708
Conversation
Initial commit for the port of TUSB to MAX32xxx parts, staring with MAX32690 - Added dcd_max32.c (based on dcd_musb.c) for interfacing with the peripheral - Added MAX32690 part family support - Added max32690evkit board support - Updated examples for unique EP number requirement - Updated get_deps.py to fetch the MSDK Known Issues / Additional Testing Required - msc_dual_lun only shown 1 volume on Windows - USBTMC does not have a valid Windowsdriver - DFU does not have a valid Windows driver - WebUSB is "Device not Recognized" - Need to test build scripts with IAR and Clang
- Added BSP for AD-APARD32690-SL board (apard32690) - Ran clang-formatting on previously committed code - Removed LOG messages from dcd_max32.c
-Added support for MAX78002, MAX78002EVKIT -Added provisions for remaining MAX32 USB parts
Updated MAX32690 and MAX78002 linker and cmake scripts to work with CMake + Ninja build system. Verified all example projects build with the tools/build.py script for both board, and both make and cmake build systems.
Added support for the MAX32666, Boards MAX32666EvKit and MAX32666FTHR.
Added support for the MAX32650/1/2 series parts - MAX32650FTHR, MAX32650EvKit, MAX32651EvKit - Added special flash rule for MAX32651 due to signing required - Added depencies to flash-msdk rules for executable
- Added MSDK flash rules for CMake - Removed partial IAR support. Uniform GCC support across MAX32 parts - Updated build scripts for correctly signing the MAX32651 - Added README files for the BSPs to describe flashing and limitiations
Correct a case-sensitive file extension issue in the MAX32690 build scripts. Did not present itself as an issue under MinGW or MSYS, just Linux.
Resolve codespell and EOF errors found in the pre-commit CI task.
thank you for your PR, I think we should update the PS: digikey backorder is 09/20, this probably take a while. |
Thanks @hathach. As part of that potential merging of the existing dcd_msub.c with my updates, should probably also look at the sunxi version as well. The scope of modifications for that were similar to mine. Unfortunate about the back order. Once you get hardware reach out if you have any questions or issues getting up and running. |
yeah, sunxi uses the same mentor usb, but it is more complicated since it is actually arm9 processor. I want to do that also but couldn't mannage the time. For dev board, this one look reasonable https://www.digikey.com/en/products/detail/analog-devices-inc-maxim-integrated/MAX32666FTHR/12727215 (lead time is 09/02), will let you know once I got the hardware. |
Yes, that board will work out well for testing. The MAX32650FTHR is also a good choice for a small form factor board, but same 9/20 lead time at Digikey. |
Feather 666 is a bigger chip with dual core but cost less than 650 and also available earlier so it is better choice I guess. |
Updated: requested by @tannewt, I did a bit more search and found mouser having these in stocks, just ordered max32650,666,690 boards (sponsored by Adafruit). It will probaly take a week or so for it to get delivery. Meanwhile @BrentK-ADI If possible, you can try to merge the dcd_max32 to dcd_musb, probably create an header musb_max32.h and abstract/put max32 specific function there. you could check out dwc2 for reference. We will try to get this merge as soon as I could. |
@hathach , I'll start digging into that merge. Hopefully can get something together by the end of the week. |
Combined the new MAX32 MUSB implementation with the existing (TI) implementation to provide generic code base for working the MUSB DCD peripheral. - Added abstraction calls for FIFO setup, EP registers, Ctrl registers and interrupt setup. - Combined TM4C and MSP432E into a single header file. - Created musb_max32.h, and removed the MAX32 specific C implementation. - Updated MAX32 build system to use dcd_musb.c. - Added MAX32 conditions for cdc_dual_ports example descriptors missed during first testing.
@hathach, I took a shot at combining the existing DCD MUSB with the new MAX32. Things were a little trickier than the dwc2 example, for a couple reasons:
With that said, as well as a couple other hooks for interrupt handling, I think the implementation is fairly clean and easy to follow, and retained all of the original dcd_musb.c logic and register handling. Let me know your thoughts. I happened to have a EK-TM4C123GXL board hanging around so was able to at least re-run the example projects on that board to verify functionality was consistent with the updates. |
@BrentK-ADI perfect thank you, my order from Mouser already shipped, it will probably delivery in a few days. Let hope we could get this merged as soon as we could. |
For some reason my codespell didn't catch that error when I ran pre-commit. I'll hold off fixing it if there are other updates needed for this merge to avoid a frivolous entry in the commit log. |
no problems, my order is in custom clearance, it should be delivered in a couple of days. |
I got the feather dev boards, will start to test/review and make changes if needed to merge this PR asap. If you have an pending update, please push it if possible to prevent conflict/merge thanks. |
I have bring this PR updated to master, add max32 to ci build and fixes some warning when compiling with cmsis header v3 (in the mcu/max32). Will do more extensive test with actual hw tomorrow. |
Tested with feather maax32866, it works as a charm, passed my local hil test with both TI tm4c and max32666, I am doing a bit of more refactor, but probably wont change the driver behavior. We probably merge this real soon (hopefully). Note: since I have both max32650 and 666, I will add one to the hil pool as well to get it tested with the ci. |
… as well. Merge ep0 and epn together
Glad things worked smoothly. Thanks for putting the time into this! |
hil: remove ch32v203 since not reliable enough
// CXD56 USB driver has fixed endpoint type (bulk/interrupt/iso) and direction (IN/OUT) by its number | ||
// 0 control (IN/OUT), 1 Bulk (IN), 2 Bulk (OUT), 3 In (IN), 4 Bulk (IN), 5 Bulk (OUT), 6 In (IN) | ||
// #define EPNUM_AUDIO_IN 0x01 | ||
// #define EPNUM_AUDIO_OUT 0x02 | ||
// #define EPNUM_AUDIO_INT 0x03 |
Check notice
Code scanning / CodeQL
Commented-out code Note
@BrentK-ADI Everything went smoothly, I push more refactor to generalize register interfacee. I also tried to include max32650 to my hardware-in-the-loop pool #2194 which is running on a Raspberry Pi 5 (flashing hardware and run test script to verify usb function). Therefore I tried to compile openocd (analog fork) https://github.com/analogdevicesinc/openocd but got following error on my Linux x86.
here is my configure (mostly default)
Maybe I miss something, would you mind poiting me to instruction to compile ADI's openocd for to run on a RPI 5. Thank you. |
@hathach As far as I know that is the right repo. I believe it should be the release branch vs adi-main or master. I was able to build that branch with the normal OpenOCD instructions:
If that's still causing you problems, I'll ping the group that maintains the tools for these MCUs on Monday and get more guidance. |
@BrentK-ADI thank you, I change the branch to release and it compiles perfectly. I was on the default adi-main previousls. Shouldd have tried that first, not too familliar with Analog tool (have been using jlink so far for developing) :) |
add feather max32666 to the hil pool
…pture example with iso kind of work but not smoothly. audio example does not seems to work as expected
I am able to add feather max32666 to the hil pool. Somehow, someway, I fried my feather max32650 while trying to flash with openocd, no 3v3 measured,power with lipo battery does not work as well (it has been doing just fine with jlink). Luckily I still have an extra max32690 ekit (though it is a bit trunky). |
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.
thank you very much for your awesome work. PR works out the box with max32650/666/690 at first try. I have done quite a bit of refactoring mostly with dcd musb (hcd isn't touched yet) with
- declare general musb register
- add musb configuraation option MUSB_CFG_SHARED_FIFO/MUSB_CFG_DYNAMIC_FIFO which is the main difference between adi and ti implementation
- indexed tx/rx register to make the code look cleaner
- implement dcd_edpt_iso_alloc()/activate() for TI port, which makes it simpler without fifo size allocation management.
- enable double buffer for ISO
most bulkd/interrupt examples work well. ISO though isn't working too well audio_test does not work as expected, video_capture (with CFG_TUD_VIDEO_STREAMING_BULK=0 for using ISO) only work as proof of concept (kind of laggy), which shouldn't be the caase with max32 with huge fifo depth. But it is probably our bug. We will fix this later with following up PR since this is already large enough.
Thanks so much for pushing this through so fast! |
No problem, I am the one to say thank. Thanks again for your contribution on the PR. There is still work for ISO endpoint, but we can do that later |
Describe the PR
Add support for the Analog Devices MCUs MAX32650/1/2, MAX32665/6, MAX32690 and MAX78002.
Additional context
The USB IP for these devices is identical amongst the part families and uses a variation of the Mentor IP core. dcd_musb.c was used as the baseline implementation, modified for the part specific FIFO, register access and PHY control.
Supported Boards: