zephyr
zephyr copied to clipboard
Add support arduino portenta h7
Thnaks @benjaminbjornsson for this work! I have started to do the same last month, but because I am new to Zephyr, the path was a bit difficult for me.
I have tried your branch myself and managed to run some samples:
- basic/blinky on M7
- basic/blinky on M4
- hello_world on M7
- subsys/console/echo on M7
- subsys/shell/shell_module on M7
- drivers/adc on M7
For the adc sample, I had to add these lines to the common dtsi:
&adc1 {
pinctrl-0 = <&adc1_inp0_pa0>;
pinctrl-names = "default";
status = "okay";
};
And this overlay in the sample:
/ {
zephyr,user {
io-channels = <&adc1 0>;
};
};
I don't own the Breakout Board to try the USB FS but I have a MachineControl on which I might test it. I also have the Ethernet Vision shield on which I plan to test the Ethernet.
Everything went well :+1:
This pull request has been marked as stale because it has been open (more than) 60 days with no activity. Remove the stale label or add a comment saying that you would like to have the label removed otherwise this pull request will automatically be closed in 14 days. Note, that you can always re-open a closed pull request at any time.
If I recap, the missing points on this PR are:
- A copyright
- Understand the core frequency issue Is that all?
If I recap, the missing points on this PR are:
- A copyright
- Understand the core frequency issue Is that all?
Yes, I fixed the other comments locally and since I couldn’t resolve the frequency problem I didn’t push it. I’d like to solve it but I spent too many hours without progress on this…
Ok, thanks for the update and the hard work! :+1: I might try as well. Is there a mean to see at which frequency the processor is actually running?
From what I have read in the ArduinoCore code, the PMIC is configured by the bootloader. In the Arduino init code, they only reduce the current of the 3.1 V rail back to 1.2 A instead of 2 A used for the Wifi startup. It should not hurt to let it to 2A for now.
Also, from this forum thread, a guy managed to use its Portenta from CubeMX, even without the bootloader so we might some info about the clocks from this project.
Indeed, I have tried the hello_world
example with this value and it does not work:
&pll {
div-m = <5>;
mul-n = <192>;
div-p = <2>;
div-q = <2>;
div-r = <2>;
clocks = <&clk_hse>;
status = "okay";
};
&rcc {
clocks = <&pll>;
clock-frequency = <DT_FREQ_M(480)>;
};
But interestingly, when running the blinky sample, the pulse duration is 4,80 seconds instead of 1 second. So there is a serious clock issue in this configuration.
I have tried to mimic this part of the ArduinoCore code: https://github.com/arduino/mbed-os/blob/fb9e38d41f947ac9844dd877a1b8e613bbea1eec/targets/TARGET_STM/TARGET_STM32H7/TARGET_STM32H747xI/TARGET_PORTENTA_H7/system_clock_override.c#L132-L141
with:
LL_AHB4_GRP1_EnableClock(LL_AHB4_GRP1_PERIPH_GPIOH);
LL_GPIO_SetPinMode(GPIOH, LL_GPIO_PIN_1, LL_GPIO_MODE_OUTPUT);
LL_GPIO_SetPinOutputType(GPIOH, LL_GPIO_PIN_1, LL_GPIO_OUTPUT_PUSHPULL);
LL_GPIO_SetPinSpeed(GPIOH, LL_GPIO_PIN_1, LL_GPIO_SPEED_FREQ_LOW);
LL_GPIO_SetPinPull(GPIOH, LL_GPIO_PIN_1, LL_GPIO_PULL_UP);
int wait_loop_counter = 1000;
while(wait_loop_counter != 0)
{
wait_loop_counter--;
}
LL_GPIO_SetOutputPin(GPIOH, LL_GPIO_PIN_1);
Here: https://github.com/zephyrproject-rtos/zephyr/blob/d2a792dd39e588b41a0834db066b7ba387122132/drivers/clock_control/clock_stm32_ll_h7.c#L727
But nothing has changed.
So the OSCEN part should be ok. It must be a config issue somewhere.
@erwango can you spot something in the dts files?
I have noticed that the following line might be needed in arduino_portenta_h7_m7_defconfig
:
CONFIG_POWER_SUPPLY_SMPS_1V8_SUPPLIES_LDO=y
But it does not help by itself :(
@romainreignier thanks for testing on your side! I’m starting to think that the best way forward may be to let the board run on the internal clock and let a future PR solve the clock issue?
Yes, if it is acceptable by the maintainers, we could stay with this clock config for now. But make it clear in the documentation.
@romainreignier thanks for testing on your side! I’m starting to think that the best way forward may be to let the board run on the internal clock and let a future PR solve the clock issue?
Fine for me.
Great, so now, the device tree needs to be modified to use HSI, right?
I'll try to have this PR updated this weekend.
@benjaminbjornsson can you check the build issues reported by CI ?
@benjaminbjornsson can you check the build issues reported by CI ?
@erwango I'm confused, it's not the board being added that fails now. Should more boards be excluded from flash_shell
or did I break something by adding the new board to the exclude list?
@benjaminbjornsson can you check the build issues reported by CI ?
@erwango I'm confused, it's not the board being added that fails now. Should more boards be excluded from
flash_shell
or did I break something by adding the new board to the exclude list?
ok, please rebase and force push
@benjaminbjornsson It seems that you're out of luck and hit be several issues non related with your commit. 2 of them were unknown till now, and I raised dedicated issues (see https://github.com/zephyrproject-rtos/zephyr/issues/48911 and https://github.com/zephyrproject-rtos/zephyr/issues/48912). Other one is known (https://github.com/zephyrproject-rtos/zephyr/issues/48608) but seems to be a tricky one.
Meanwhile, can you check following remaning comment: https://github.com/zephyrproject-rtos/zephyr/pull/45221#discussion_r923043484 ?
It seems that the only remaining issue is the line about the user button in the description text file. It should not take too much time to remove @benjaminbjornsson Thank you.
It seems that the only remaining issue is the line about the user button in the description text file. It should not take too much time to remove @benjaminbjornsson Thank you.
PR also requires a rebase. Note that we're now in the process of releasing V3.2.0 and PR that are not bug fixes will now have to wait that the V3.2.0 is fully released before being merged.
Sorry for the delay, I've removed the line about the push-button in the index now and also rebased.