ESP32 USB-C to iPhone 16 USB-C communication

Hi everyone,

I am seeking clarification regarding the communication capabilities between an ESP32 microcontroller and Apple's latest devices, specifically the iPhone 16 Pro Max and iPad Pro, both equipped with USB-C ports.

Background:

MFi Certification: Historically, establishing communication between external devices and iOS devices required MFi (Made for iPhone/iPad) certification. But I remember this being necessary in the Lightning Cable to USB era.

With the introduction of USB-C ports in recent iPhone and iPad models, there is an indication that MFi certification may no longer be necessary for certain peripherals. Perhaps I'm not confident on the terminology here: https://mfi.apple.com/en/who-should-join

Project Requirements: I am working on a sensor research project that necessitates the collection of low-latency time-series data from an ESP32 microcontroller, which features a USB-C port. The data needs to be transmitted to an iPhone 16 Pro Max or iPad Pro. Bluetooth communication has proven insufficient due to its limited data transfer rates (~1.2 Mbps with L2CAP). While NEHotspot could be an alternative, it restricts the iPad's internet connectivity. Therefore, establishing a direct USB-C connection between the ESP32 and the iOS device appears to be the most viable solution.

Questions:

MFi Certification Necessity: Is MFi certification still required for an ESP32 microcontroller to communicate with iPhone 16 Pro Max or iPad Pro via USB-C?

USB-C Communication Support: Do the iPhone 16 Pro Max and iPad Pro natively support serial communication over USB-C with microcontrollers like the ESP32? If not, are there recommended protocols or interfaces to facilitate this communication?

App Development Considerations: Would developing a custom iOS application be necessary to handle data transmission from the ESP32 over USB-C? If so, are there specific APIs or frameworks provided by Apple to support this functionality?

Data Transfer Rates: Considering the need for high-speed data transfer, are there any limitations or considerations regarding the data transfer rates achievable through a USB-C connection between the ESP32 and iOS devices?

Thank you!

Answered by DTS Engineer in 821888022
Is MFi certification still required for an ESP32 microcontroller to communicate with iPhone 16 Pro Max or iPad Pro via USB-C?

This is one of those places where iOS and iPadOS differ.

  • On iPadOS you can use DriverKit to communicate with a custom USB device. That’s not an option on iOS.

  • Both iOS and iPadOS support MFi, so you could build it that way.

Do the iPhone 16 Pro Max and iPad Pro natively support serial communication over USB-C with microcontrollers like the ESP32?

Not in the way you’re looking for.

Both iOS and iPadOS have built-in support for a wide range of USB classes, and device in that class appear are accessible via higher-level APIs: a PIV device is visible to the system via CryptoTokenKit, an audio device via our extensive audio API, and so on. However, the list of supported classes doesn’t include serial [1].

Would developing a custom iOS application be necessary to handle data transmission from the ESP32 over USB-C?

Probably. It might be feasible to implement a USB class and then bend the built-in class driver to do what you want, but even that’s going to need an app to gather the results.

If so, are there specific APIs or frameworks provided by Apple to support this functionality?

On iPadOS, you have DriverKit.

On iOS and iPadOS, you can talk to MFi accessories using External Accessory.

Considering the need for high-speed data transfer, are there any limitations or considerations regarding the data transfer rates achievable through a USB-C connection between the ESP32 and iOS devices?

I don’t have enough experience at that level to respond to that. I’m gonna to ask one of my colleagues to chime in.

Share and Enjoy

Quinn “The Eskimo!” @ Developer Technical Support @ Apple
let myEmail = "eskimo" + "1" + "@" + "apple.com"

[1] Although it does on macOS.

Is MFi certification still required for an ESP32 microcontroller to communicate with iPhone 16 Pro Max or iPad Pro via USB-C?

This is one of those places where iOS and iPadOS differ.

  • On iPadOS you can use DriverKit to communicate with a custom USB device. That’s not an option on iOS.

  • Both iOS and iPadOS support MFi, so you could build it that way.

Do the iPhone 16 Pro Max and iPad Pro natively support serial communication over USB-C with microcontrollers like the ESP32?

Not in the way you’re looking for.

Both iOS and iPadOS have built-in support for a wide range of USB classes, and device in that class appear are accessible via higher-level APIs: a PIV device is visible to the system via CryptoTokenKit, an audio device via our extensive audio API, and so on. However, the list of supported classes doesn’t include serial [1].

Would developing a custom iOS application be necessary to handle data transmission from the ESP32 over USB-C?

Probably. It might be feasible to implement a USB class and then bend the built-in class driver to do what you want, but even that’s going to need an app to gather the results.

If so, are there specific APIs or frameworks provided by Apple to support this functionality?

On iPadOS, you have DriverKit.

On iOS and iPadOS, you can talk to MFi accessories using External Accessory.

Considering the need for high-speed data transfer, are there any limitations or considerations regarding the data transfer rates achievable through a USB-C connection between the ESP32 and iOS devices?

I don’t have enough experience at that level to respond to that. I’m gonna to ask one of my colleagues to chime in.

Share and Enjoy

Quinn “The Eskimo!” @ Developer Technical Support @ Apple
let myEmail = "eskimo" + "1" + "@" + "apple.com"

[1] Although it does on macOS.

Thank you! I'd love to hear your colleagues opinions.

Another Question: The only thing I can't understand at the moment is if I need to go through the MFi process just for development to use ExternalAccessory? My purposes at the moment are for a research study.

The following is the architecture that I'm trying to make.

So far, it looks like I need about 10 Mbps to stream data over to the iOS app. The main reason is that I have several EMG sensors that record at 120hz. For certain reasons, it does need to be as real-time as I can make it, batching isn't an option.

10 Mbps is not a lot, but it's too much for Bluetooth Low Energy, even if I use CoreBluetooth's L2CAP. With L2CAP, I only get about 1 Mbps.

I could use NEHotspot to the app to connect to the ESP32 over Wi-Fi, but the problem is if the user uses an iPad without Cellular Service, they will disconnect from the Cloud service.

So the only option I can see now is to leverage the USB-C cable, which should have plenty of bandwidth to stream the sensor data over.

Another Question: The only thing I can't understand at the moment is if I need to go through the MFi process just for development to use ExternalAccessory?

In terms of creating a fully MFi licensed accessory the answer is, yes. You'd need to join the MFi program to get access to the necessary specifications and, presumably, eventually ship an accessory.

However, from your general description this sounds like you're working on something that's intended to be low volume, not a full production accessory. There's a hint about an alternative option for this sort of product on the "Who Should Join" page in this entry:

"Individuals creating accessories for personal use. We recommend using a third-party hobbyist solution to connect iOS devices to serial devices, and to write apps that communicate with these serial devices."

As one example of this approach, RedPark <https://redpark.com> sells a number of MFi serial port adaptors (USB-C or Lightning) and a corresponding iOS SDK. They'll also help create and MFi licence custom cables/adaptor for cases where the volume or product value is high enough to justify a more bespoke product, but not high enough to justify the cost and complexity of creating a standalone MFi product.

Covering a few more options:

On iPadOS, you have DriverKit.

A few points to be aware of here:

  • DriverKit does not provide support of background communication, while ExternalAccessory does.

  • DriverKit development can quite difficult, particularly for anyone not already extremely familiar with macOS's internal architecture and IOKit in particular.

Frankly, even on iPadOS, I think a serial port adaptor based solution is a better option than DriverKit.

Lastly, on this point:

I could use NEHotspot to the app to connect to the ESP32 over Wi-Fi, but the problem is if the user uses an iPad without Cellular Service, they will disconnect from the Cloud service.

If you're seriously considering a network based solution and this is a foreground application, then the other option is to connect to your accessory over ethernet. This is often overlooked, but iOS has LONG (iOS 10.2?) supported ethernet. Our USB-C device can use standard USB-C to ethernet adaptors, while Lightning devices can either use USB adaptors connected through a Lightning adaptor or a direct Lightning to USB adaptor, for example:

https://redpark.com/lightning-gigabit-ethernet-poe-adapter-l6-netpoe/

__
Kevin Elliott
DTS Engineer, CoreOS/Hardware

ESP32 USB-C to iPhone 16 USB-C communication
 
 
Q