Message Port and ESP32

Support for Arduino in combination with Air Manager and Air Player

Moderators: russ, Ralph

Post Reply
Message
Author
AaronH
Posts: 2
Joined: Sun Nov 20, 2022 3:24 am

Message Port and ESP32

#1 Post by AaronH »

Hi all,
I've been successfully using the Message Port library on an Arduino UNO for a while but I was wondering if it was possible to run Message Port on an ESP32? I have an ESP32 flashed and it appears in Air Manager (v4.1.5) as a Message Port based device, however I cannot seem to configure an instrument to use it.

The code below is what I am using for a test instrument and when using the Arduino UNO I configure MCU1 as "Arduino UNO" and "Channel A" (under the hardware properties of the instrument), however there is no option to select an ESP32.

Code: Select all

function new_message(id, payload)
  print("received new message with id " .. id)
end
id = hw_message_port_add("MCU1", new_message)

User avatar
jph
Posts: 2846
Joined: Fri Apr 10, 2020 12:50 pm
Location: Somewhere over the rainbow..

Re: Message Port and ESP32

#2 Post by jph »

Call it anything you want (from the list of supported processors). Messageport doesn't care as the name is only there to help you. It doesn't do anything
Call it the same as the UNO to test. -

Although ESP32 is on the list for messageport devices at the Arduino end (SI_MESSAGE_PORT_DEVICE_ESP32) it doesnt seem to recognise the name - for example - "ESP32_B" at the AM end. (or on the pull down list

For now just call it an uno, or a mega - providing the device and port letter both are the same as both ends, it makes absolutely no difference to the operation.

Joe
Joe. CISSP, MSc.

User avatar
jph
Posts: 2846
Joined: Fri Apr 10, 2020 12:50 pm
Location: Somewhere over the rainbow..

Re: Message Port and ESP32

#3 Post by jph »

Another thing I would definitely recommended is to SPECIFICALLY name your hardware and not rely on selecting it from a list.
I see absolutely no point in doing that. You have to be 100% sure you have the correct hardware when using messageport.
Something like -

Code: Select all

pedestal_737 = hw_message_port_add("RPI_PICO_M", pedestal_data_rx) 

function pedestal_data_rx(pedestal_737, payload)
-- do some goodies
end

-- perform sanity check !
if hw_connected("RPI_PICO_M") then
  print("We have the right hardware hooked up !")
end
This way you get no 'pull down selection list' and you can be reasonably sure the hardware is correct. The list is then superfluous.

An even better way is - (and gets around typos)

Code: Select all

pedestal_controller_board = "RPI_PICO_M" -- master board reference for this code

pedestal_737 = hw_message_port_add(pedestal_controller_board, pedestal_data_rx)

function pedestal_data_rx(pedestal_737, payload)
-- do some goodies
end

-- sanity check - stop if not correct
if hw_connected(pedestal_controller_board) then
  print("We have the right hardware hooked up !")
end
you should not see any board selection options. You can also listen for an appropriate signal from the specific board for belts and braces.;)
Joe. CISSP, MSc.

AaronH
Posts: 2
Joined: Sun Nov 20, 2022 3:24 am

Re: Message Port and ESP32

#4 Post by AaronH »

Thanks @jph! That certainly resolved it :)

User avatar
jph
Posts: 2846
Joined: Fri Apr 10, 2020 12:50 pm
Location: Somewhere over the rainbow..

Re: Message Port and ESP32

#5 Post by jph »

No worries.
Out of interest why chose the ESP32 ?
Have a you a particular application in mind for it ?
There are some really neat products out now that will run messageport including the new S3 esp32 and the STM32 dev boards. Its a damn quick board is the old esp32 :)
Joe
Joe. CISSP, MSc.

User avatar
Ralph
Posts: 7876
Joined: Tue Oct 27, 2015 7:02 pm
Location: De Steeg
Contact:

Re: Message Port and ESP32

#6 Post by Ralph »

I think that came from Air Player Mini. We're throwing Air Player Mini out with 4.2, so he chose to use Messageport so he can still put them to good use.

User avatar
jph
Posts: 2846
Joined: Fri Apr 10, 2020 12:50 pm
Location: Somewhere over the rainbow..

Re: Message Port and ESP32

#7 Post by jph »

Hi Ralph, my understanding is that he IS using it for messageport. Its listed on the wiki as a supported device for messageport and is seen ok in AM devices with the mp library but the appropriate device naming is missing in AM itself for communication. It works fine if you call it somthing else, it is simply the esp32 part missing from the device selection in AM, as said, it is listed as already supported in messageport. Minor issue and I am sure it is easily resolved when the new mp device options are added in 4.2
Joe
Joe. CISSP, MSc.

Post Reply