Skip to content

boards: support Arduino Portenta C33 #85337

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

Merged
merged 2 commits into from
Jun 4, 2025
Merged

Conversation

facchinm
Copy link
Collaborator

@facchinm facchinm commented Feb 6, 2025

As per title, this PR is a WIP for Arduino Portenta C33 support.
The porting status is quite advanced but it's still missing a couple of very important features.
Based on RA6M5 microcontroller, onboard peripherals that need to be supported are:

https://builds.zephyrproject.io/zephyr/pr/85337/docs/boards/arduino/portenta_c33/doc/index.html

@zephyrbot zephyrbot added platform: Renesas RA Renesas Electronics Corporation, RA area: Bluetooth HCI Bluetooth HCI Driver area: Bluetooth labels Feb 6, 2025
@facchinm facchinm requested a review from soburi February 6, 2025 17:00
@facchinm facchinm force-pushed the c33 branch 2 times, most recently from 0339d5e to c323a15 Compare February 6, 2025 17:48
@Thalley Thalley removed their request for review February 6, 2025 17:54
@beriberikix
Copy link

Is there a reason to use esp_host over esp_at, which is already in-tree? Unfortunately that's also missing SPI support.

CONFIG_UART_INTERRUPT_DRIVEN=y
CONFIG_CONSOLE=y

CONFIG_USE_DT_CODE_PARTITION=y
Copy link
Collaborator

Choose a reason for hiding this comment

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

Suggested change
CONFIG_USE_DT_CODE_PARTITION=y

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

This needs to be set to preserve the default functionality (with dfu bootloader). Is there another way to achieve the same result?

Copy link
Collaborator

Choose a reason for hiding this comment

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

if this is required then needs to go in Kconfig and the board Kconfig select it

return 0;
}

SYS_INIT(eth_pwm_clock_enable, POST_KERNEL, CONFIG_CLOCK_CONTROL_PWM_INIT_PRIORITY);
Copy link
Collaborator

Choose a reason for hiding this comment

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

have a common .c file with all of the code functions then use a board hook to run a function which runs them

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I removed the USB init file (which was a dirty solution anyway), will apply #85294 whrn it gets merged

@facchinm
Copy link
Collaborator Author

facchinm commented Feb 7, 2025

Is there a reason to use esp_host over esp_at, which is already in-tree? Unfortunately that's also missing SPI support.

When we had to decide which firmware to flash on the network companion, esp-at for ESP32C3 was brand new and very unstable, so we took the other direction 🥲

@facchinm facchinm force-pushed the c33 branch 2 times, most recently from e420a66 to 8c92038 Compare February 7, 2025 09:19
@hermabe hermabe removed their request for review February 7, 2025 11:04
thaoluonguw
thaoluonguw previously approved these changes May 29, 2025
soburi
soburi previously approved these changes May 29, 2025
@pillo79 pillo79 force-pushed the c33 branch 2 times, most recently from 1713673 to 21007d6 Compare May 30, 2025 06:58
@pillo79
Copy link
Collaborator

pillo79 commented May 30, 2025

Review and CI comments addressed. @nordicjm please revisit.

Comment on lines 4 to 5
zephyr_library()
zephyr_library_sources_ifdef(CONFIG_NETWORKING board.c)
Copy link
Collaborator

Choose a reason for hiding this comment

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

Suggested change
zephyr_library()
zephyr_library_sources_ifdef(CONFIG_NETWORKING board.c)
if(CONFIG_NETWORKING)
zephyr_library()
zephyr_library_sources(board.c)
endif()

otherwise will have an empty library warning when NETWORKING is disabled

Copy link
Collaborator

Choose a reason for hiding this comment

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

Thanks for pointing this out. Having a board.c conditional on NETWORKING looked strange as well, so I renamed the file to eth_clock.c and dropped the library step.

facchinm added 2 commits May 30, 2025 10:53
Tested:
* GPIO
* UART
* USB (using USB_DEVICE_NEXT)
* BLE

Signed-off-by: Martino Facchin <m.facchin@arduino.cc>
Signed-off-by: Luca Burelli <l.burelli@arduino.cc>
Will complete the supported peripheral list and description later

Signed-off-by: Martino Facchin <m.facchin@arduino.cc>
Copy link

@pillo79
Copy link
Collaborator

pillo79 commented Jun 3, 2025

@nordicjm please revisit, thanks! 🙇

@pillo79
Copy link
Collaborator

pillo79 commented Jun 4, 2025

@nordicjm thanks for the review, concerns should have been addressed. [...]

EDIT: Note that I had to restore the SYS_INIT entry as in the original PR, because neither early nor late board hooks are acceptable to set up the Ethernet clock; it needs to be exactly between PWM clock init and Eth device init.

@nordicjm As already mentioned last week, I need precise ordering between the above devices:

  • early board hook is executed before the clock subsys is even initialized,
  • late board hook is after the Ethernet device is probed unsuccessfully due to the missing clock.

I see no way to achieve this without a SYS_INIT... 🙁 but really open to suggestions!

@nordicjm
Copy link
Collaborator

nordicjm commented Jun 4, 2025

@nordicjm thanks for the review, concerns should have been addressed. [...]
EDIT: Note that I had to restore the SYS_INIT entry as in the original PR, because neither early nor late board hooks are acceptable to set up the Ethernet clock; it needs to be exactly between PWM clock init and Eth device init.

@nordicjm As already mentioned last week, I need precise ordering between the above devices:

* `early` board hook is executed before the clock subsys is even initialized,

* `late` board hook is after the Ethernet device is probed unsuccessfully due to the missing clock.

I see no way to achieve this without a SYS_INIT... 🙁 but really open to suggestions!

FYI @nashif

@kartben kartben merged commit b927659 into zephyrproject-rtos:main Jun 4, 2025
21 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area: Bluetooth HCI Bluetooth HCI Driver area: Bluetooth platform: Renesas RA Renesas Electronics Corporation, RA
Projects
None yet
Development

Successfully merging this pull request may close these issues.