10 years, 7 months ago.

serial port generating characters.. "0xff"

Hi, i am using the LPC1768 mbed hooked up a wifly module with the serial port and ran the code below. and the first command works fine.. when processing the 2nd command. i see the first letter and a bunch of characters just an in the screen shot. and the characters are still being generated even I disconnect the tx & rx wires. the ASCII table says ÿ is 0xFF.

EDIT: im using tera term.. even tried hTerm.. the same thing is happening!

any suggestions how to get this solved or whats the problem??

my code

#include "mbed.h"

Serial pc(USBTX,USBRX);
Serial wifly(p9,p10);

void pcReader();
void wifiReader();


int main() {
    pc.attach(&pcReader);
    wifly.attach(&wifiReader);
    wait(5);
    wifly.printf("$$$");
    wait(3);
    wifly.printf("exit\r");
    
    while(1) {
    }
}

void pcReader(){
    if(pc.readable())
        wifly.putc(pc.getc());
}
    
void wifiReader(){
    if(wifly.readable())
        pc.putc(wifly.getc());
}
 

/media/uploads/kaushalpkk/untitled.png

2 Answers

10 years, 7 months ago.

After sometime with the FRDM mbed.. the same thing happened.. finally found the problem and the solution!!

when the serial port was sending '$$$' the wifly was not in command mode so it sent of the characters happily.. when it entered the command mode and started sending 'exit\r' the serial interrupt kicked in after serial sending e.. and i guess the mbed got crazy and started sending those characters..

the solution is simple.. just turn off echo using 'set uart mode 0x01\r'

Accepted Answer
10 years, 7 months ago.

Hi Krishna some advices:

  • put a wait in the first line of main, this is to allow the device (wifly) to powered correctly
  • try to receive the response of the command mode without an interruption

Let me know if it works

Greetings

Hi Ney,

I've tired your suggestions!! the problem still persists.. but i'm running the same code on a FRDM-MBED works great!!

thanks!

posted by Krishna Kaushal Panduru 05 Sep 2013