UART programming as Arduino board [Particle Photon]

Hello! I need to program radios. The main cable on the radio has three ports TX, RX, gnd. Consequently, when connecting to the Photon, I can not use the com port to read data from the radio. In the arduino it was possible to use the board and UART to flash other boards (ST, AVR, attiny e.t.c.), is it possible with the Photon?

@Sudama, welcome to the Particle Community!

I’m not sure what you mean by this. The Photon has a serial port, Serial1, connected to the TX and RX pins. Unlike an Arduino which uses 5v TX and RX signals, the Photon uses 3.3v signals. From your diagram, it’s unclear what your radio needs. However, it is possible to use level shifters to convert signals from 3.3v to 5v and back.

What have you tried so far?

2 Likes

Thank you for your reply. The radios work with 3.3 to 5V, I think the problem is with the serial port. I wonder if it works with the same logic (particle photon) as the arduino. Maybe you need to do a reset (reset -gnd) or something similar?

@Sudama, can you share your code? Are you trying to replace the CP2102 USB-to-Serial board with a Photon?

1 Like

Exactly. I’m trying to set up a particle photon as a usb-uart converter. The arduino worked without using any code, do I need any code to work with the particle photon? And is it possible to work with the particle photon as a usb converter?

The Arduino has an onboard USB-to-Serial chip which the Photon does not so yes, you will need some code. However, it is very basic as it simply “repeats” everything it sees on the Serial (aka USB) port to Serial1 (the TX/RX pins) and vice versa.

2 Likes

@Sudama, here is some code you can use.

#include "Particle.h"

SYSTEM_MODE(MANUAL);  // Disable WiFi, Particle Cloud connection

#define BAUD    9600     // Baudrate for Serial1 port

void setup() {
    Serial.begin();
    Serial1.begin(PLC_BAUD);
}


void loop() {
    if (Serial1.available()) {
        Serial.write(Serial1.read());
    }
    if (Serial.available()) {
        Serial1.write(Serial.read());
    }
}
3 Likes

Thanks! It’s working!

2 Likes

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.