Hello all :)
I am trying to send a character serially from one LPC1768 to the other over RF 434MHz link and print them on the terminal of a PC.
However when trying to send a character from one controller to other, the receiver doesn't seem to pick up the character at all. Specifically, "serial.readable()" never returns '1' meaning there is no character to read at all.
When I do a loop-back test using both "serial.readable()" and "serial rx interrupt" using a single controller(meaning that the transmitter and receiver connected to the same controller), it works fine in both cases..
The problem arises when I attach the receiver and transmitter to two different LPC1768's.
The receiver and controller are powered by their corresponding controllers via GND and VU pins
Transmitter
#include "mbed.h"
Serial pc(USBTX, USBRX); // tx, rx
Serial device(p9, p10); // tx, rx
DigitalOut myled1(LED1);
int main()
{
device.baud(2400);
while (1)
{
//RF Transmit Code
if (pc.readable()==0) {
myled1 = 1;
//Send 10101010 pattern when idle to keep receiver in sync and locked to transmitter
//When receiver loses the sync lock (Around 30MS with no data change seen) it starts sending out noise
device.putc(0xAA);
myled1 = 0;
} else
//Send out the real data whenever a key is typed
{
pc.printf("Sent character is: ");
pc.putc(device.putc(pc.getc()));
pc.printf("\n");
}
}
}
Receiver
#include "mbed.h"
Serial pc(USBTX, USBRX); // tx, rx
Serial device(p13, p14); // tx, rx
DigitalOut myled1(LED1);
DigitalOut myled2(LED2);
int main()
{
char temp=0;
device.baud(2400);
while (1)
{
myled1=1;
//RF Receive Code
if(device.readable()) {
myled2 = 1;
temp=device.getc();
//Ignore Sync pattern and do not pass on to PC
if (temp!=0xAA)
{
pc.printf("Received character is: ");
pc.putc(temp);
pc.printf("\n");
}
myled2 = 0;
}
}
}
If I remove the "if(device.readable())" condition, it gets stuck in device.getc().
Any idea why this isn't working?
Any other ways to read data via RF 434MHz modules?
Any help would be appreciated. Thanks in advance.
Hello all :) I am trying to send a character serially from one LPC1768 to the other over RF 434MHz link and print them on the terminal of a PC. However when trying to send a character from one controller to other, the receiver doesn't seem to pick up the character at all. Specifically, "serial.readable()" never returns '1' meaning there is no character to read at all. When I do a loop-back test using both "serial.readable()" and "serial rx interrupt" using a single controller(meaning that the transmitter and receiver connected to the same controller), it works fine in both cases.. The problem arises when I attach the receiver and transmitter to two different LPC1768's. The receiver and controller are powered by their corresponding controllers via GND and VU pins
Transmitter
Receiver
If I remove the "if(device.readable())" condition, it gets stuck in device.getc(). Any idea why this isn't working? Any other ways to read data via RF 434MHz modules? Any help would be appreciated. Thanks in advance.