Replies: 6 comments
-
@bkkrunal I can't comment on your W5500 problem, but your You should reformat your code above like so HTH, |
Beta Was this translation helpful? Give feedback.
-
@Floessie |
Beta Was this translation helpful? Give feedback.
-
Hi, @feilipu |
Beta Was this translation helpful? Give feedback.
-
Something like this: void DebugMonitor(void *pvParameters)
{
(void) pvParameters;
for (;;) // A Task shall never return or exit.
{
while(Serial.available() > 0)
{
temp = Serial.read();
Serial1.write(temp);
}
vTaskDelay(1); // Nothing was available, give other tasks a chance
}
} HTH, |
Beta Was this translation helpful? Give feedback.
-
Thanks for the reply. |
Beta Was this translation helpful? Give feedback.
-
Hi, #include <SPI.h>
#include <Ethernet.h>
#include <Arduino_FreeRTOS.h>
byte mac[] = { 0xDE, 0xAD, 0xBE, 0xEF, 0xFE, 0xED };
IPAddress ip(192, 168, 43, 177);
char temp;
void setup()
{
Serial.begin(115200);
Serial1.begin(115200);
pinMode(25, OUTPUT); //Relay Driver_CS
digitalWrite(25, HIGH);
pinMode(A4, OUTPUT); // SD_CS
digitalWrite(A4, HIGH);
pinMode(53, OUTPUT); // Ethernet CS
digitalWrite(53, HIGH);
pinMode(9, OUTPUT); //Reset pin of W5100
digitalWrite(9, HIGH);
Serial.println(F("Initialising Ethernet..."));
if (Ethernet.begin(mac) == 0)
{
Serial.println(F("Failed to configure Ethernet using DHCP"));
Ethernet.begin(mac, ip);
Serial.print(F("IP= "));
Serial.println(Ethernet.localIP());
}
else
{
Serial.print(F("IP= "));
Serial.println(Ethernet.localIP());
}
xTaskCreate(
DebugMonitor
, (const portCHAR *) "MonitorUSART"
, 128 // Stack size
, NULL
, 2 // Priority
, NULL ); //Task Handle
}
void DebugMonitor(void *pvParameters)
{
(void) pvParameters;
for (;;) // A Task shall never return or exit.
{
while(Serial.available() > 0)
{
temp = Serial.read();
//Serial.println(temp); //Checked--> the data recieved from Serial
Serial1.write(temp); //Sending the recieved data to Serial1
}
vTaskDelay(1);
}
}
void loop()
{
} Also, this is the code I am using to receive data from Serial1 of MEGA to Arduino nano: char temp;
void setup() {
// Setting up the baud for synchronization
Serial.begin(115200);
}
void loop() {
// Recieving data if available.
while(Serial.available() > 0)
{
temp = Serial.read();
Serial.println(temp);
}
} I am not sure about ethernet W5500 as I haven't tried on the same. Hopefully, it is the issue with the ethernet and not with the Arduino_FreeRTOS compatibility of making the Serial and ethernet work together. |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Hi Phillip,
I am trying to use hardware usart and ethernet shield V2 (having W5500) together on MEGA2560.
I first initialise ethernet module in setup(), which works fine.
Then I initialize serial port with RTOS task and try to read the data from port using this task.
The problem I am facing is that I never receive any data on serial port after initialising the ethernet.
However, I am able to send data using serial port even after ethernet initialisation.
I observed that my Serial.available() in the task never returns any value other than 0.
If I just remove the ethernet initialising code, then I can receive and send data on the serial port.
I am using this library for ethernet shield.
https://github.com/PaulStoffregen/Ethernet
I tried by increasing the stack size of the task as well with no luck.
Please suggest.
Regards,
BK Krunal
Beta Was this translation helpful? Give feedback.
All reactions