Thanks to visit codestin.com
Credit goes to github.com

Skip to content

ports/renesas-ra: Add support for Portenta C33. #11405

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 15 commits into from
Sep 14, 2023

Conversation

@dpgeorge
Copy link
Member

When VK-RA6M5 is merged, how much will this board have in common with that one, in the ra_cfg and ra_gen and src directories of the board?

I notice that EK_RA4M1 and RA4M1_CLICKER have a large amount of those files in common, so I'm thinking that these files should not be in the board directories but rather in a directory that is for MCUs, eg ports/renesas-ra/mcu/ra4m1 etc (similar to samd). Then all boards using the same MCU can share those files.

@iabdalkader
Copy link
Contributor Author

how much will this board have in common with that one, in the ra_cfg and ra_gen and src directories of the board?

That depends on how similar the project configs are, all of those files are auto-generated based on the chip, package, project settings, enabled stacks/peripherals etc.. I guess maybe one very generic project per chip/series can be generated, and shared, but somehow it must enable/support everything that could be needed by all boards that use it.

@dpgeorge
Copy link
Member

See #11590 for a start at reducing the amount of code in the board directories. I would like to simplify things a lot more before adding support for new boards, so those new boards can be much simpler.

@iabdalkader
Copy link
Contributor Author

See #11590 for a start at reducing the amount of code in the board directories. I would like to simplify things a lot more before adding support for new boards, so those new boards can be much simpler.

That's okay I'm still waiting on all of the deps above (updated), and btw I'm going to add networking support in this PR for this board/port via lwip, it's going to use raw eth <-> esp.

@iabdalkader
Copy link
Contributor Author

Adding #11680 as a dependency, because it's needed for bluetooth (which is working now btw) and now I'm working on WiFi.

@iabdalkader
Copy link
Contributor Author

Note this PR is outdated, will update it once the main deps are merged.

@dpgeorge
Copy link
Member

Do we need to wait for TinyUSB support for this board?

@iabdalkader
Copy link
Contributor Author

Do we need to wait for TinyUSB support for this board?

Yes, will ping them to merge the support, update the submodule and rebase this PR, then it will be ready for a review. Note this PR is Very outdated (been working in my fork).

@iabdalkader iabdalkader force-pushed the arduino_portenta_c33 branch from 9ef7b76 to 3531c37 Compare June 27, 2023 14:00
@codecov
Copy link

codecov bot commented Jun 27, 2023

Codecov Report

Merging #11405 (174bb28) into master (397697a) will not change coverage.
Report is 15 commits behind head on master.
The diff coverage is n/a.

@@           Coverage Diff           @@
##           master   #11405   +/-   ##
=======================================
  Coverage   98.38%   98.38%           
=======================================
  Files         158      158           
  Lines       20940    20940           
=======================================
  Hits        20602    20602           
  Misses        338      338           

@iabdalkader iabdalkader force-pushed the arduino_portenta_c33 branch 4 times, most recently from a2c017c to af4c660 Compare June 27, 2023 14:14
@iabdalkader
Copy link
Contributor Author

iabdalkader commented Jun 27, 2023

@dpgeorge This is now rebased and updated, it can be reviewed & merged, and the board can be added to the build script later when the TinyUSB PR is merged, or it can wait.

Any idea why code-formatting fails ? I can't understand the error output.

Bluetooth tests:

./run-multitests.py -i pyb:a0 -i pyb:a1 multi_bluetooth/*py

18 tests performed
14 tests passed
2 tests skipped: multi_bluetooth/ble_deepsleep.py multi_bluetooth/stress_log_filesystem.py
2 tests failed: multi_bluetooth/ble_l2cap.py multi_bluetooth/perf_l2cap.py

./run-multitests.py -i pyb:a1 -i pyb:a0 multi_bluetooth/*py
18 tests performed
14 tests passed
2 tests skipped: multi_bluetooth/ble_deepsleep.py multi_bluetooth/stress_log_filesystem.py
2 tests failed: multi_bluetooth/ble_l2cap.py multi_bluetooth/perf_l2cap.py

Networking tests:

./run-multitests.py -i pyb:a0 -i pyb:a1 multi_net/*
20 tests performed
16 tests passed
2 tests skipped: multi_net/asyncio_tcp_client_rst.py multi_net/tcp_client_rst.py
2 tests failed: multi_net/asyncio_tcp_readall.py multi_net/udp_data.py

./run-multitests.py -i pyb:a1 -i pyb:a0 multi_net/*
20 tests performed
16 tests passed
2 tests skipped: multi_net/asyncio_tcp_client_rst.py multi_net/tcp_client_rst.py
2 tests failed: multi_net/ssl_cert_rsa.py multi_net/udp_data.py

CC @robert-hh you may find this new ESP32 "hosted" driver/firmware interesting.

@github-actions
Copy link

github-actions bot commented Jun 27, 2023

Code size report:

   bare-arm:    +0 +0.000% 
minimal x86:    +0 +0.000% 
   unix x64:    +0 +0.000% standard
      stm32:    +0 +0.000% PYBV10
     mimxrt:    +8 +0.002% TEENSY40[incl -8(data)]
        rp2:  +524 +0.160% RPI_PICO[incl -12(bss)]
       samd:   +44 +0.017% ADAFRUIT_ITSYBITSY_M4_EXPRESS[incl -8(data) -16(bss)]

@dpgeorge
Copy link
Member

Any idea why code-formatting fails ? I can't understand the error output.

That can happen when the code formatter gets confused by # macro indenting. You can try running ./tools/codeformat.py on a subset of the files to narrow down which one it's failing one.

@iabdalkader
Copy link
Contributor Author

That can happen when the code formatter gets confused by # macro indenting. You can try running ./tools/codeformat.py on a subset of the files to narrow down which one it's failing one.

I think I ran it on all files before sending the PR, also it tends to print out a lot of errors/warnings when I run it on my local machine, so I'm never sure if it's actually working or failing.

@iabdalkader iabdalkader force-pushed the arduino_portenta_c33 branch 2 times, most recently from 6ab66c2 to 55695d2 Compare June 29, 2023 08:48
@iabdalkader
Copy link
Contributor Author

@dpgeorge I ran the code formatter again on all files, and disabled format checking for the 2 auto-generated protobuf files (which were already formatted) and it's not passing the format check not sure what else to do, otherwise it's ready for review.

@iabdalkader iabdalkader force-pushed the arduino_portenta_c33 branch from 55695d2 to 3b7fd29 Compare July 2, 2023 15:19
It needs to be enabled explicitly by a board.

Signed-off-by: iabdalkader <[email protected]>
This is a host driver for ESP32 chips running the esp-hosted firmware,
which turns ESP32s into a WLAN/BT co-processor.

Signed-off-by: iabdalkader <[email protected]>
Add DAC, SCE and USB FSP config files.

Signed-off-by: iabdalkader <[email protected]>
@dpgeorge dpgeorge force-pushed the arduino_portenta_c33 branch from b8307c9 to 78d8d9f Compare September 14, 2023 13:52
@dpgeorge
Copy link
Member

@iabdalkader I'm about to merge this and have force pushed it with some minor changes. But I just noticed that the ports/renesas-ra/boards/ARDUINO_PORTENTA_C33/script/fsp.ld file seems to be unused, and no other renesas-ra board has this file. Can this file be removed?

If yes I will remove it during the merge, so please just let me know either way.

@iabdalkader
Copy link
Contributor Author

But I just noticed that the ports/renesas-ra/boards/ARDUINO_PORTENTA_C33/script/fsp.ld file seems to be unused, and no other renesas-ra board has this file. Can this file be removed?

Yes it's definitely not used.

@dpgeorge dpgeorge force-pushed the arduino_portenta_c33 branch from 78d8d9f to 174bb28 Compare September 14, 2023 14:11
@dpgeorge
Copy link
Member

But I just noticed that the ports/renesas-ra/boards/ARDUINO_PORTENTA_C33/script/fsp.ld file seems to be unused, and no other renesas-ra board has this file. Can this file be removed?

Yes it's definitely not used.

OK, thanks for confirming. I have removed it.

@dpgeorge dpgeorge merged commit 174bb28 into micropython:master Sep 14, 2023
@iabdalkader iabdalkader deleted the arduino_portenta_c33 branch September 14, 2023 14:37
@robert-hh
Copy link
Contributor

robert-hh commented Sep 17, 2023

@iabdalkader Just tried to build that firmware, which fails with a problem of the protobuf compiler, which seems not to be built. Any hint?

protoc-c --proto_path=../../drivers/esp-hosted/ --c_out=build-ARDUINO_PORTENTA_C33/extmod/ ../../drivers/esp-hosted/esp_hosted.proto
make: protoc-c: Datei oder Verzeichnis nicht gefunden

It does not find protoc-c, which according to the README is created.

Edit: There is a command protoc on the system. Calling build with PROTOC=protoc runs into anotehr error:

protoc --proto_path=../../drivers/esp-hosted/ --c_out=build-ARDUINO_PORTENTA_C33/extmod/ ../../drivers/esp-hosted/esp_hosted.proto
protoc-gen-c: program not found or is not executable
Please specify a program using absolute path or make sure the program is available in your PATH system variable
--c_out: protoc-gen-c: Plugin failed with status code 1.

Edit 2: In addition to protobuf-compiler I had to install protobuf-codegen.

@iabdalkader
Copy link
Contributor Author

@robert-hh I have no problem building here on Arch, this command is echo'd:

protoc-c --proto_path=../../drivers/esp-hosted/ --c_out=build-ARDUINO_PORTENTA_C33/extmod/ ../../drivers/esp-hosted/esp_hosted.proto

Also the autobuild seems to be working https://micropython.org/download/ARDUINO_PORTENTA_C33/

However, for renesas-ra it seems to be missing the *.bin CC @dpgeorge

@robert-hh
Copy link
Contributor

robert-hh commented Sep 17, 2023

After adding protobuf-generator, protoc-c is available as well, which is linked to protoc-gen-c.
Edit: I run a debian machine.

@robert-hh
Copy link
Contributor

Out of interest, I combined the esp-hosted MicroPython firmware and a ESP32 with NINA firmware. BLE works, not much better that with the NINAW10 MicroPython firmware, but consistent. Test coverage is still low, but consistent. Interestingly, stress_log_filesystem.py passes all the time.
That indicates that it is the newer esp-idf version which improves BLE with the ESP32 module.

@dpgeorge
Copy link
Member

However, for renesas-ra it seems to be missing the *.bin CC @dpgeorge

Fixed by b0e03b3

@iabdalkader
Copy link
Contributor Author

That indicates that it is the newer esp-idf version which improves BLE with the ESP32 module.

Unfortunately updating the Nina firmware to a newer IDF is not that easy.

@robert-hh
Copy link
Contributor

@iabdalkader Yesterday I tested again the esp_hosted based WiFi/BLE support for the SAMD port after having rebased the respective PR when needed. But now it refuses to work properly. The TCP test is slow and error-prone. Webrepl works only if started in foreground mode. UDP tests are fine.
Since the adaption for esp-hosted is almost the same as in the renesas port, could you please check for the renesas port if WiFi still works fine and Webrepl can be regulary started.

@iabdalkader
Copy link
Contributor Author

Yes I can test it later today and get back to you.

@iabdalkader
Copy link
Contributor Author

The Portenta C33 firmware no longer works. It seems that the last working firmware is micropython-1.22.1.

CC @dpgeorge

@iabdalkader
Copy link
Contributor Author

@robert-hh managed to get 1.24 working again and ran the tests again. Note NTP is set and all .der files are copied to FS.

multi_net/tcp_data.py on ttyACM0|micropython: pass
multi_net/udp_data.py on ttyACM0|micropython: pass
24 tests performed
20 tests passed
1 tests skipped: multi_net/sslcontext_getpeercert.py
3 tests failed: multi_net/asyncio_tcp_client_rst.py multi_net/sslcontext_server_client_files.py multi_net/tcp_client_rst.py

And

multi_net/tcp_data.py on micropython|ttyACM0: pass
multi_net/udp_data.py on micropython|ttyACM0: pass
24 tests performed
20 tests passed
3 tests skipped: multi_net/asyncio_tcp_client_rst.py multi_net/sslcontext_getpeercert.py multi_net/tcp_client_rst.py
1 tests failed: multi_net/ssl_cert_rsa.py

@robert-hh
Copy link
Contributor

Thank you for the feedback. What are the transfer rates in a test with iperf3. What I observed is a huge drop in transfer speed for TCP. UDP still works fine.

@iabdalkader
Copy link
Contributor Author

>>> iperf3.client("192.168.1.100")
CLIENT MODE: TCP sending
Connecting to ('192.168.1.100', 5201)
Interval           Transfer     Bitrate
  0.00-1.01   sec   116 KBytes   940 Kbits/sec
  1.01-2.01   sec   133 KBytes  1.09 Mbits/sec
  2.01-3.01   sec   200 KBytes  1.63 Mbits/sec
  3.01-4.01   sec   222 KBytes  1.82 Mbits/sec
  4.01-5.01   sec   228 KBytes  1.87 Mbits/sec
  5.01-6.01   sec   231 KBytes  1.89 Mbits/sec
  6.01-7.01   sec   231 KBytes  1.89 Mbits/sec
  7.01-8.01   sec   228 KBytes  1.87 Mbits/sec
  8.01-9.01   sec   234 KBytes  1.92 Mbits/sec
  9.01-10.00  sec   225 KBytes  1.87 Mbits/sec
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 
  0.00-10.00  sec  2.00 MBytes  1.68 Mbits/sec  sender
  0.00-10.44  sec  2.00 MBytes  1.60 Mbits/sec  receiver

@iabdalkader
Copy link
Contributor Author

I can't find the old number but they look in line with what I remember.

@robert-hh
Copy link
Contributor

robert-hh commented Jul 29, 2024

@iabdalkader Thanks. I managed to get it back to speed. It was a test version of the esp_hosted firmware, which was rebased to the current master. So maybe better not use it.
Edit: The transfer rates now much yours.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants