How do I get to the SPI port in python

I have a portenta x8 and I would like to use the spi port on the NXP® i.MX 8M
Mini. The H7 uses 'import pyb' to get to its spi module but that module is not available on the portenta x8. I listed all the modules with a help('modules') command in the python script and it is not available.

Any ideas?

The H7 appears to use microPython from how I read the docs.

The X8 is different:

Portenta X8 customers can also gain access to a FoundriesFactory subscription service for fleet management. The Portenta X8 implementation of Linux microPlatform OS supports programming languages like Python, Javascript, Java, Go, and Rust.

From the above, it appears that you will need to update the Linux OS tools for Python.

A few attempts at searching on how to upgrade Python on the H8 did not provide a definitive process. Perhaps you can explore the Yocto Project by
IoT Device Management | Open Source IoT Platform | Foundries.io

Seems there are some proprietary binaries in the X8

The X8 uses a Linux distribution built with the Yocto Project® as the base platform, with applications that are installed and packaged as confined containers.
A ready-made Linux distribution that packages everything seems most attractive for end users but you need to find a distribution that implements the function that you need. If you need to tweak them you may end up in a mess of patches on the top of someone else's build system. On the other hand, a generic distribution has some problems since installing software over it may pollute the original system and cause issues when updating the base platform.

From what I get from reading Arduino’s marketing material, the NXP® i.MX 8M
Mini side of the H8 is meant to be the administrator that provides an actual operating system while the H7 provides the interface to the physical world. Is there an advantage to doing SPI on the Linux side as opposed to on the Arduino side?

Not sure of an advantage but NXP® i.MX 8M Mini side of the Protenta x8 has 3-spi ports and 4-IIC ports and I would like to use them.

Well, maybe you can figure out how to load Micropython on the M4 core. I don’t know if it has the dfu bootloader or not.

After rereading the H8 documentation, it doesn’t look like the end user will be doing any programming on the M4 core. They’ll have to expose the peripherals in the M4 core via some sort of Python module that uses RPC-like calls, I guess, which means the proprietary software they reference will accommodate that. It seems strange that they haven’t made it clear yet how they intend to do that.

Well, this toy is out of my price range; but I have serious concern about "proprietary" in any sentence with "Arduino."

I have done a couple of Raspberry Pi + Arduino projects and that was straightforward, so the concept plays well in my mind; the proprietary binary blobs in RPi annoy me too... but we are not talking $240 U.S.D. either!

IMO, commercial use of the Protenta X8 is a major unknown with additional moneys being driven into support/maintenance from
image

Yeah that proprietary part bothers me too. It's obvious they released this thing too soon when you have to come to a hobby forum for help. For $240, you'd expect the documentation to be pretty solid.

I don't see the H8 becoming real popular with the tinkerers. you can cobble together a similar setup for a lot less.

A post was split to a new topic: There is a lack of examples for this board

I wrote some responses before noticing this was a 2.5 year old topic that had been bumped by a hijacker, but thought I would publish what I wrote anyway in case it will be of benefit to anyone who finds this forum topic while doing research for information about the Portenta X8.

I realize that at the time of the previous posts, the documentation was less comprehensive than it is now.

Please note that use of the "FoundriesFactory" fleet management service is completely optional. Portenta X8 users who aren't interested in using that can still use and manage the Linux machine without any limitations:

https://docs.arduino.cc/tutorials/portenta-x8/user-manual/#working-with-linux

https://docs.arduino.cc/tutorials/portenta-x8/image-flashing/

https://docs.arduino.cc/tutorials/portenta-x8/image-building/

I remember this fact was not not communicated very well by the documentation back in 2022.

You can upload Arduino sketches on the M4 core:

https://docs.arduino.cc/tutorials/portenta-x8/user-manual/#board-architecture-overview

  • STMicroelectronics STM32H747AII6 featuring 1x Arm® Cortex®-M7 core running up to 480 MHz and 1x Arm® Cortex®-M4 core running up to 240 MHz. This microcontroller hosts the "Arduino Mbed OS Portenta Boards" Core. M4 core is accessible and programmable by the user, while M7 is dedicated to establishing and guaranteeing the communication between i.MX 8M Mini and M4, as well as to manage peripherals through RPC.

https://docs.arduino.cc/tutorials/portenta-x8/user-manual/#working-with-arduino-ide

Although of course it is available to and used by some in the hobbyist/maker market, the Portenta X8 is not targeted to that market. This board is part of the "Arduino PRO" line:

I don't see any reference to the M4 processor in the "Arduino Mbed OS Portenta Boards" tab in the board menu. How would you create a program to load to the M4?

You only need to select Tools > Board > Arduino Mbed OS Portenta Boards > Arduino Portenta X8 from the Arduino IDE menus and you are all set.

Unlike the Portenta H7, where you can upload a sketch to either of the cores by selecting the target from the Tools > Target core menu, when using the Portenta X8 you can only upload to the M4 core, so there is no need for any additional configuration.

1 Like