I have write a c code for rp2040 in arduino ide. But i have not give actual output.
Please find the below code.
#ifdef ARDUINO_ARCH_MBED_RP2040
// For the Arduino MBedOS Core, we must create Serial2
UART Serial2(8, 9, NC, NC); #else
// For the Earl Philhower core ( earlephilhower (Earle F. Philhower, III) · GitHub )
// Serial2 is already defined. #endif
void setup() {
Serial.begin(9600);
Serial1.begin(115200);
Serial2.begin(115200);
while (!Serial)
; // Serial is via USB; wait for enumeration
}
void loop() {
Serial.println("This is port "Serial"");
Serial1.println("1111111111111\r\nThis is port "Serial1"");
Serial2.println("2222222222222\r\nThis is port "Serial2"");
if (Serial1.read() > 0) { // read and discard data from UART0
Serial.println("Input detected on UART0");
}
if (Serial2.read() > 0) { // read and discard data from UART1
Serial.println("Input on UART1");
}
delay(2000);
}
I have sent data through the Serial Monitor, but I am not receiving it. According to the code, I should be receiving the character I sent through the Serial Monitor
This is port"Serial""
input on UART1.
This is port "Serial""
2222222222222
This is port "Serial2
Input on UART1
When data is sent from Serial Monitor then that is on "Serial".
void setup() {
Serial.begin(9600);
Serial1.begin(115200);
Serial2.begin(115200);
while (!Serial)
; // Serial is via USB; wait for enumeration
}
void loop() {
if (Serial.read() > 0)
{
Serial.println("you sent a char");
}
}
With a minimal circuit of UART0 Tx connected to UART1 Rx and UART0 Rx connected to UART1 Tx, the quick & dirty sketch below demonstrates TTL level communication between Serial1 and Serial2 and outputs the results to the Serial port.
You will find it exceedingly difficult to have Serial2 do anything useful with nothing connected to its pins (GPIO8 & 9). As to the rest, I have no idea what you have hooked up or why.
The RP2040 dose not use TTL signals. It is a 3V3 device and only sends and receives 3V3 logic signals. TTL is a 5V signal.
Once you send anything to a serial monitor, that is it. In other words the signal goes nowhere else. So monitoring the signal on the serial port prevents any other use.
I can't help what ever some unknowable person refers to it it. But TTL stands for "Transistor Transistor Logic" which by definition is a 5V signal.
If you try and stuff a 5V signal into a RP2040, physics takes over the argument, and you will damage it.
An Arduino Uno, and a lot of other models, will generate 5V TTL signal. However some Arduinos have a 3V3 processor, and the signal from them can be passed safely into a RP2040.
I know plenty of highly knowledgeable engineers who will specify the signal levels as "3.3V TTL" or "5V TTL" when discussing logic circuits. Everyone understands what they're talking about, including component manufacturers.
Thank you for your technical support. I have multiple time create a code for ttl to rp2040. finally i realise i have a some issue with hardware connection.
Again thank you so much for reply