Notifications
Clear all

Using UART2, TX/RX on the P3 Socket, Help needed  

  RSS
rogerinhawaii
(@rogerinhawaii)
Estimable Member
Using UART2, TX/RX on the P3 Socket, Help needed

I NEED SOME ADVICE

I've added some new hardware to my Prusa i3 MK3, made mods to the Prusa Firmware, and want to control the new hardware with a separate Arduino.

I want to communicate between the firmware on the Prusa using the TX/RX pins on the Arduino and the TX/RX pins on the P3 connector on the Einsy Rambo board on the Prusa. Those pins on the P3 are the UART2 that's accessible from the firmware. I want to use UART2 because both its pins are 5V, compatible with the 5V pins on the Arduino.

I've connected the corresponding pins with jumper wires, TX to RX, RX to TX, GND to GND.

I've written code for the Arduino that takes in text from it's RX pin and, for the moment, just causes the LED on the Arduino to blink to let me know that it's receiving something.

I've made mods to the Prusa Firmware such that, under certain circumstances, it sends text out through UART2, through the TX pin in the P3 Connecter.

But it's not working. As far as I can tell no communication is happening between the Prusa and the Arduino. nothing is going out through the P3's TX pin.

So I need some help.

In the Prusa firmware side I . . .

#include <uart2.h>

In the firmware setup() method I . . .

void setup()

{

    #define BaudRateBetweenUart2AndArduinoNanoEvery 115200

    uart2_init(BaudRateBetweenUart2AndArduinoNanoEvery);

    etc.

}

During testing I also tried 9600 (and other) baud rates with no success.

Based on suggestions by others I created a simple method to do the sending of text out to the UART2 . . .

void my_vfprintf_P(const char *fmt, ...)

{

    va_list args;

    va_start(args, fmt);

    vfprintf_P(uart2io, fmt, args);

    va_end(args);

}

and in the place within the Prusa firmware where I want to do sending of text, I call the above method like this

const char TextToSend[] PROGMEM = "TURN ON LIGHT\n";

my_vfprintf_P(TextToSend);

But when I run the Arduino (feeding it a GCode file with special GCodes intended to make it send text through UART2) and have the Arduino attached and running,

NOTHING HAPPENS.

I've put in diagnostics in the Prusa Firmware so I do know that my new code in there is in fact getting to the call to my_vfprintf_P(TextToSend);

I've put in diagnostics in my Arduino code and it does indicate that it's getting to the . . .

if (Serial.available() > 0)

but nothing is ever available.

WHAT AM I MISSING?

Am I doing something wrong? Do I need to change how I'm accessing UART2? Need to do something else to "activate" the UART2?

Does anyone have experience with this who might point me in the right direction to a resolution?

Posted : 09/06/2024 10:43 pm
ChrisG
(@chrisg)
Member
RE: Using UART2, TX/RX on the P3 Socket, Help needed

do you have the source code from the Buddyboard MK3.5? I tought you can only G-Code true the Uart port.

Posted : 11/06/2024 1:43 pm
rogerinhawaii
(@rogerinhawaii)
Estimable Member
Topic starter answered:
RE: Using UART2, TX/RX on the P3 Socket, Help needed

I've never heard of the Buddyboard.

By default you can send GCode through the USB connector to the Prusa, which uses UART0.

You can also add a Raspberry Pi to the J19 connector on the Einsy Rambo and od standard GCode transmission over it. That uses UART1. Unfortunately the TX pin on the J19 connector operates at 3.3V to be compatible with the Raspberyy Pi. There IS a small circuit board that converts between different voltages, but there's no actual 3.3V SOURCE on the Einsy Rambo that can be used for that conversion circuit.

But there's ANOTHER connector, the P3 connector that has TX/RX pins (both of which are 5V !) and it's for UART2. THAT is what I am now attempting to use. It is NOT setup to do GCode processing, which is fine for my application. I'm sending OTHER information between the Einsy Rambo and an Arduino.

That is what I'm having trouble with and am seeking help with.

Posted : 11/06/2024 4:43 pm
rogerinhawaii
(@rogerinhawaii)
Estimable Member
Topic starter answered:
RE: Using UART2, TX/RX on the P3 Socket, Help needed

I did a search around and it appears that the Prusa Buddy Board is the main control board for the Prusa MINI and MINI+.

I don't see how that helps me with my current issue.

I DO have the Marlin Firmware which is the main software that runs on Prusa printers. Perhaps it's also used on the MINI and MINI+.
And I am making modifications to that firmware and adding some additional hardware that I want to control.

Posted : 11/06/2024 5:40 pm
ChrisG
(@chrisg)
Member
RE: Using UART2, TX/RX on the P3 Socket, Help needed

You are in the wrong area of the forum. This is for the MK3.5 you heft to to Mk3s

Posted : 12/06/2024 11:14 am
rogerinhawaii
(@rogerinhawaii)
Estimable Member
Topic starter answered:
RE: Using UART2, TX/RX on the P3 Socket, Help needed

I originally posted this in a different forum and was directed to THIS forum for the appropriate place to post it.

Now you're saying this place is not correct either???

THIS forum is for User mods, right?? Well I'm doing a mod to my Prusa. It makes no difference if it's for Mk3, Mk3.1, MK3.2 or whatever. The issue I'm encountering is the same for any of them.

WHERE do you propose I go???

Posted : 12/06/2024 5:27 pm
ChrisG
(@chrisg)
Member
RE: Using UART2, TX/RX on the P3 Socket, Help needed

You need to be in https://forum.prusa3d.com/forum/original-prusa-i3-mk3s-mk3-user-mods-octoprint-enclosures-nozzles/

Posted by: @rogerinhawaii

I originally posted this in a different forum and was directed to THIS forum for the appropriate place to post it.

Now you're saying this place is not correct either???

THIS forum is for User mods, right?? Well I'm doing a mod to my Prusa. It makes no difference if it's for Mk3, Mk3.1, MK3.2 or whatever. The issue I'm encountering is the same for any of them.

WHERE do you propose I go???

 

 

Posted : 12/06/2024 7:03 pm
Share: