Embedded Freaks..

August 17, 2008

RS232 Serial Sniffer/Monitoring Circuit

Filed under: embedded-tips — Tags: — kunilkuda @ 4:01 pm

I’m having trouble debugging the AVR-to-GSM modem serial communication.

Fortunately, my colleague has made me a circuit to view the communication. Unfortunately, it takes two serial ports just to debug the serial communication while my laptop doesn’t have any serial ports (I use USB-serial converter). So, I was thinking to buy another USB-serial converter, before I was struck by this idea.

Here’s the simplest circuit to debug the RS232 serial communication between two devices:

(more…)

August 13, 2008

Reading from serial port (using rxtx)

Filed under: java — Tags: , , — kunilkuda @ 9:29 am

Once you’ve got the serial InputStream, reading would be easy. Here’s an example of code to read the serial port using InputStream:

/**
 * Buffer to hold the reading
 */
private byte[] readBuffer = new byte[400];

private void readSerial() {
    try {
        int availableBytes = inStream.available();
        if (availableBytes > 0) {
            // Read the serial port
            inStream.read(readBuffer, 0, availableBytes);

            // Print it out
            System.out.println(
                    new String(readBuffer, 0, availableBytes));
        }
    } catch (IOException e) {
    }
}

But the real problem comes from the place where you should place the code.
(more…)

August 12, 2008

Serial port event in rxtx

Filed under: java — Tags: , , — kunilkuda @ 6:26 am

So, what do you expect from serial port event ? Most probably is the notification whether you’ve got new data in the buffer or not. But for some people (like me) who deals with real modem (I use GSM modem for server communication), we need RTS/CTS notification as well. Otherwise, we will flood the modem with data, since most PCs are faster than modem.

I’ve tested some of rxtx serial port events in Linux, and here’s some report that you might be interested.
(more…)

« Newer PostsOlder Posts »

Blog at WordPress.com.