See - https://siminnovations.com/forums/viewt ... 314#p48314 - Joe JPH 5 Sept 2022
Hi Mick, at the moment it wont work with messageport unless you add a serial/usb converter to one of the HW serial ports on the pico. You can use a simple FTDI board. You need to make a small change to the SRC files for messageport on the arduino in the simessageport lib. Basically change the serial port in use from serial to serial1 (or whatever). It will then work via the FDI converter.
At the moment AM is looking for a FIXED baudrate of 115200 from the serial port and when using CDC over HID - which is what the PICO does - the baudrate is completely ignored and the comms is as fast as the pc and device can transfer data. AM is not aware of this in Messageport and at the moment, there is no way around that without using the FTDI or similar.
When Corjan gets back I am hoping he will make a version of the MP lib that specifically allows the CDC comms as the possibilities with the pico are amazing on both AM and certainly with MP.
Even at the moment when using the Pico with AM in the non messageport way the comms is via CDC so is incredibly fast. Another reason this is the device to use for AM no nasty serial ports (although they do have their use, just not here )
I am sure it will be here at some point.
If you want to play and have an FTDI or similar then find the si_message_port_driver.cpp file in the src directory of the lib in arduino edit it to look like the second version here - first is original - second is modded.
Code: Select all
#include "si_message_port_driver.h"
#include "Arduino.h"
void si_message_port_driver_init() {
Serial.begin(115200);
}
void si_message_port_driver_sync(struct SiCircularData* input_buffer, struct SiCircularData* output_buffer) {
uint8_t byte;
if ( (Serial.availableForWrite() > 0) && (si_circular_poll(output_buffer, 0, &byte) == SI_OK) ) {
Serial.write(byte);
}
while ( (Serial.available() > 0) && (si_circular_data_free(input_buffer) > 0) ) {
si_circular_push(input_buffer, Serial.read());
}
}
Code: Select all
#include "si_message_port_driver.h"
#include "Arduino.h"
void si_message_port_driver_init() {
// Serial.begin(115200);
Serial1.begin(115200); // Use Serial1 -- NOTE - we still need to specify our baudrate as 115,200 as we are now using standard serial via the FTDI
}
void si_message_port_driver_sync(struct SiCircularData* input_buffer, struct SiCircularData* output_buffer) {
uint8_t byte;
//if ( (Serial.availableForWrite() > 0) && (si_circular_poll(output_buffer, 0, &byte) == SI_OK) ) {
// Serial.write(byte);
// Changed to Serial 1
if ( (Serial1.availableForWrite() > 0) && (si_circular_poll(output_buffer, 0, &byte) == SI_OK) ) {
Serial1.write(byte);
}
//while ( (Serial.available() > 0) && (si_circular_data_free(input_buffer) > 0) ) {
// si_circular_push(input_buffer, Serial.read());
// Changed to Serial 1
while ( (Serial1.available() > 0) && (si_circular_data_free(input_buffer) > 0) ) {
si_circular_push(input_buffer, Serial1.read());
}
}