Garbage data on Serial Port

Discussion in 'Embedded Systems and Microcontrollers' started by Anuj Mattoo, Jun 26, 2016.

  1. Anuj Mattoo

    Thread Starter New Member

    Jun 26, 2016
    6
    0
    Hi

    I have readymade working electronic product. I am applying reverse engineering on it. The WiFi module is connected to microcontroller via UART( RX & TX). The android app sends command to wifi and microcontroller works as per the command. I have attached a USB to TTL cable on RX and TX also command ground as well of WiFi module. The cable is connected to serial monitor on PC. When the app send data to WiFi, the serial monitor shows garbage value, which is not readable. I have checked every baud rate possible. Instead of USB to TTL cable, I also used HC05 bluetooth module. But it shows garbage value. How can I get the readable values on my serial monitor. Do i need to disconnect micro controller from WiFi??

    Please help
     
  2. MaxHeadRoom

    Expert

    Jul 18, 2013
    10,547
    2,373
    Is the micro using a RS232 convertor? MX232 etc?
    The max232 inverts the data.
    Max.
     
  3. Anuj Mattoo

    Thread Starter New Member

    Jun 26, 2016
    6
    0
    No, the micro controller is directly connected to WiFi moudle via UART (RX, TX , VCC , GND)

     
  4. Papabravo

    Expert

    Feb 24, 2006
    10,144
    1,790
    Baudrate is not the only source of problems. You also have to worry about databits {7,8}, parity {ODD, EVEN, NONE}, and stopbits {1, 2}. If some device is using a nonstandard baudrate without the prime factors 2,3, and 5 then that is also a problem. Aschematic block diagram of your setup might also be helpful. I for one cannot follow your verbal description of your setup.
     
  5. Anuj Mattoo

    Thread Starter New Member

    Jun 26, 2016
    6
    0
    Yes, there can be various factors. I can explain you the flow diagram. The 8051 Microcontroller is connected to WiFi module via UART. The android app sends some values, like ON/OFF led, PWM values..etc to WiFi Module via HTTP protocol. I just want to decode what exactly app is sending to WiFi module. For that, I connected a USB to serial cable to RX & TX of WiFi module. When I press something on App, the serial monitor shows some odd symbols, but those symbols doesn't change randomly. They do occur repeatedly, if same function is performed on app i.e the values are constant for the functions on app. Every function has specific odd looking symbols. What to do? I can attach the WiFi module datasheet with this post.

     
  6. shteii01

    AAC Fanatic!

    Feb 19, 2010
    3,392
    497
    So. Android device (phone/tablet/whatever) uses wifi to send data to wifi module. Wifi module is connected to pc? using usb cable.

    What is the point of having 8051 connected to the wifi module?
     
  7. Anuj Mattoo

    Thread Starter New Member

    Jun 26, 2016
    6
    0
    The 8051 controls the whole electronic part, like Leds, motors. It is an IoT product. So the function of WiFi Module is to receive the command from app and send to controller via UART. For decoding purpose I connected the USB to serial cable to WiFi Module, to see what data it sends. But unfortunately the serial monitor shows some Indecipherable data on serial monitor.


     
  8. NorthGuy

    Active Member

    Jun 28, 2014
    604
    121
    Are you sure the WiFi module uses UART on RX/TX pins? How do you know the baud rate you use to sample it is correct?
     
  9. Anuj Mattoo

    Thread Starter New Member

    Jun 26, 2016
    6
    0
    Yes, I am pretty sure. I have checked the connections. I just checked every possible Baud rate from 4800 to 115200.

    I have attached the screenshot as well (Converted to Hex as well) . The 0D part is enter command. The first two images has similar data but with different baud rate. First image data is set at 4800 and second one at 9600 with No parity, 8 bit data, stop bit 1. "0D" is just enter command( For readability).
     
    Last edited: Jun 26, 2016
  10. Papabravo

    Expert

    Feb 24, 2006
    10,144
    1,790
    You don't get it do you? I'm not the only one that can't figure out from your WRITTEN description WTF you are doing. Make a freaking diagram -- what's the problem??
     
  11. NorthGuy

    Active Member

    Jun 28, 2014
    604
    121
    You don't need to guess the baud rate. You just look at the signal with a scope or with logic analyzer and measure it. It doesn't have to be any pre-defined baud rate. Do you have a datasheet for WiFi module?
     
  12. Sensacell

    Well-Known Member

    Jun 19, 2012
    1,130
    267
    If your terminal gives you a consistent, repeatable output, then your setup is probably working.

    What are you expecting the data to look like? maybe it's just simple binary data using non-ASCII codes.
    That will look like "Garbage Values" on any terminal- unless you understand what you are looking for.
     
  13. shteii01

    AAC Fanatic!

    Feb 19, 2010
    3,392
    497
    I am guessing that it would require reading wifi module datasheet.
     
Loading...