Raspberry PICO not working with message port, named hardware

Discuss suspected bugs with other users and Sim Innovations Staff

Moderators: russ, Ralph

Message
Author
wendy
Posts: 46
Joined: Sun Aug 26, 2018 7:48 am
Contact:

Re: Raspberry PICO not working with message port, named hardware

#31 Post by wendy »

Thanks Corjan for looking into this.

Regards, Wendy

User avatar
Corjan
Posts: 2936
Joined: Thu Nov 19, 2015 9:04 am

Re: Raspberry PICO not working with message port, named hardware

#32 Post by Corjan »

Hi,


Fixed the Serial.write issue and also noticed that the SI_MESSAGE_PORT_DEVICE_RPI_PICO definition was missing.
When that is used, AM will show the correct icon/name.

Both are now improved, there is a new Arduino library available here:
https://siminnovations.com/wiki/index.php?title=Arduino

Also just uploaded the latest AM BETA 43, which has the Serial port fix.


Hope this fixed everything, please let me know if something is still not working like it should,

Corjan

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

Re: Raspberry PICO not working with message port, named hardware

#33 Post by jph »

Downloading now, thank you very much Corjan,
:D

Joe
Joe. CISSP, MSc.

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

Re: Raspberry PICO not working with message port, named hardware

#34 Post by jph »

Small issue -

The problem with the pico initialising is solved. Connects fine.

If we call it an 'uno' at both ends, it works fine. (it is forcing hardware selection I notice) - so select arduino UNO and port A in the pulldown menus - all works

If I call it a pico - then it will show as a raspberry pi pico device with the logo ok, then I have to select from the pulldown so choose pico, channel A, and nothing.
no errors, just no communication.

As said, exactly the same program at both ends with the new MP lib and the AM Beta works fine providing the device is not named as a pico ?

Weird.

I am using one of my dev programs so I will write a very simple turn on led program to test. - a hello world type - will get back to you ;)
Joe
Joe. CISSP, MSc.

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

Re: Raspberry PICO not working with message port, named hardware

#35 Post by jph »

example to test - both ends - using new MP lib and also new AM beta.

message_id 100 will turn on the on board pico built in led
and
message_id 101 will turn on the off board pico built in led

Arduino sketch PICO

Code: Select all

#include <si_message_port.hpp>                                                                                    
SiMessagePort* messagePort;      // initialise our messagport object - here we chose the name 'messagePort'

void setup() {                         //  setup: run once
  messagePort = new SiMessagePort(SI_MESSAGE_PORT_DEVICE_ARDUINO_UNO, SI_MESSAGE_PORT_CHANNEL_A, new_message_callback);
  //messagePort = new SiMessagePort(SI_MESSAGE_PORT_DEVICE_RPI_PICO, SI_MESSAGE_PORT_CHANNEL_A, new_message_callback); 
  pinMode(LED_BUILTIN,OUTPUT);
}                                      //    setup end

void loop() {                          // main program loop 
messagePort->Tick(); // make sure to call frequently  
}                                      //    loop end

 static void new_message_callback(uint16_t message_id, struct SiMessagePortPayload* payload) {
  // Do something with a message from Air Manager or Air Player
  if (message_id == 100){
  digitalWrite(LED_BUILTIN,HIGH);
  }
  
  if (message_id == 101){
  digitalWrite(LED_BUILTIN,LOW);
  }
  
}
 
and the AM lua

Code: Select all

pico_test_led = hw_message_port_add("PICO_1", new_message_received) -- add our hardware device

function new_message_received(pico_led_test, payload)
--  
end

hw_message_port_send(pico_test_led,100) -- pico built in led on
--hw_message_port_send(pico_test_led,101) -- pico built in led off
when using it as a named 'uno' it works fine, as a pico it doesnt. (that is setting it in Arduino as UNO A and selecting UNO A from pull down options in AM works. As pico in Arduino and selecting PICO A from pull down options in AM it does not communicate.

Hope that helps ?

Joe
Joe. CISSP, MSc.

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

Re: Raspberry PICO not working with message port, named hardware

#36 Post by jph »

Just for an experiment - do you have a complete list of the hardware IDs for the devices for messageport in AM ? - I have never seen them published.
Thanks
Joe

EDIT _ ignore the above I can use the prefixes from the HARDWARE ID master list. doh...
Joe. CISSP, MSc.

wendy
Posts: 46
Joined: Sun Aug 26, 2018 7:48 am
Contact:

Re: Raspberry PICO not working with message port, named hardware

#37 Post by wendy »

Just tested with the new MP library and the AM Beta .

Same result as Joe I think...

-if you call it PICO, it is recognized automatically but no communication between PICO and the LUA script via messageport.
-if you cal it Arduino NANO for example, you see Arduino NANO in Air Manager and after selecting the device "Arduino Nano" and "Channel" it communicates.

Should be nice if we can call the device anything we want ?? Don't know if it is supposed to behave like that... :lol:

Regards, Wendy

User avatar
Corjan
Posts: 2936
Joined: Thu Nov 19, 2015 9:04 am

Re: Raspberry PICO not working with message port, named hardware

#38 Post by Corjan »

Hi,


Ah yes, I forgot to add something in the communication layer.
Is fixed now and will be part of next BETA release, which should be online now.


Corjan

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

Re: Raspberry PICO not working with message port, named hardware

#39 Post by jph »

@Corjan
All working superbly :D

Also the

Code: Select all

if hw_connected("RPI_PICO_A") then
  print("We have the right hardware hooked up !")
end
works exactly as it should also.

Thank you for the super work as always.
I am going to duck under the table and ask for a feature request but I will post it in another thread after hiding and taking out insurance. ;)
Joe
Joe. CISSP, MSc.

wendy
Posts: 46
Joined: Sun Aug 26, 2018 7:48 am
Contact:

Re: Raspberry PICO not working with message port, named hardware

#40 Post by wendy »

@Corjan

Everything works fine now.
Thank you for a fast and perfect and great service.

@joe
Thanks for your help

Regards, Wendy

Post Reply