Loading...
  Show Posts
Pages: [1]
1  Using Arduino / Networking, Protocols, and Devices / Re: Connect to Usb Slave Virtual COM on: May 27, 2011, 01:23:28 am
Or you're thinking to connect a USB-SerialConverter over a USB-HOST shield to arduino??
2  Using Arduino / Networking, Protocols, and Devices / Re: Mysterious RS485 problem on: May 25, 2011, 07:43:13 am
For the resolution of my problem i made these things and the system is now working:

- I rechecked the needs for transmission from the slaves to master. If there is not a diagnosis by hand on going, the slave devices are not sending any messages to the master.
- For the receiving, (i dont know why but) i kept the
Code:
Serial.println
lines, as the DE pin not enabled. by doing this the system works as expected. I think if i remove the Serial.println lines and add delay(10) for example the system is going to work because of the flow of my code.
- For further projects, if i will need to send data in all directions i'll implement 2 max485 chips for each side, one is for sending and other for receiving.

Thank you very much for your answers.

Mert
3  Using Arduino / Networking, Protocols, and Devices / Re: Mysterious RS485 problem on: May 25, 2011, 07:30:38 am
Hi everyone,
I have some short of "mysterious" problem as well with the RS485. In fact I have connected and LCD, a keyboard and a MAX485 to the chip. I have developed a menu  that shows in the LCD and I can navigate through it using the keypad. I have also a sensor transmittting i n RS485 connected to the MAX485 that is connected to my serial port. Problems is:
-Only reception of data from sensor and display it in the LCD works fine
-Only navugation through the mmenu works fine (transmission disabled)
- If I navigate while receiving, it works fine for a while, but suddenly the menus get stuck and reception stops. No more information is received (I have tested sensor is still sensing).
Any idea why this can be happening?
(I also checked problem of overflow in buffer, but there is not such a problem)
Thanks!

Using the 485 line in half duplex mode is not a good idea as i learned. But with your project for the RS485 line only the sensor is connected? Or all lcd, keypad and stuff are on a RS485 bus?
4  Using Arduino / Networking, Protocols, and Devices / Re: Mysterious RS485 problem on: May 17, 2011, 06:44:12 am
No No, OP is here smiley As i read and think, some new questions come but when i come to check i see that someone has already asked it. I'm following the thread carefully.

For the project, I'll try to insert delays instead "Serial.print" lines. But till now i could not have enough time to finish it. Thank you for answers. After doing more tests i'll share the results.


Mert
5  Using Arduino / Networking, Protocols, and Devices / Re: Mysterious RS485 problem on: May 16, 2011, 04:24:50 am
The debugging option is added to check if the transmission and the system running correctly. But in normal usage it is not used. In fact as you said i dont need two masters. Pc is the master. But according to protocol development i may need a second master. But this (second) master will act as requested. So protocol says no slave device can send info by themselves. This is certain.

As I read in the datasheet of MAX485, it says there is a Fail-Safe circuit inside the chip. This guarantees when there is no traffic, the RO line will be high. I checked this and this is ok. I thougt no biasing needed. Just the termination.

Yesterday night i tried sth and the thing start to work normal. Here are the details:

- First i removed the MAX485 lines and checked with a TTL serial connection.
- Very strange that ATmega328 does not understand the bit pattern even if it receives it.
- I changed the code:
-  -  According to the protocol a command is formed with:
      1 Byte header; which is   (byte) 90 --> (char)'Z'
      4 Byte address
      1 to 6 bytes command
thus:
Code:
if (Serial.available()){
        //incoming command
        byte rec = 0;
        rec = Serial.read();
        [i]//Serial.print(rec,DEC);  /*--> if i uncomment this line i see all data i've sent so data arrives at the chip and it replies back. but no action*/[/i]
        //serial data filtering
        //first byte must be <Z>
        if (rec == 90){
            //following 4 bytes must be id
            //Serial.println("Serial Data begin"); //--> *
            if (checkIdNr()){
                //idNr is correct
                //Serial.println("ID nr match");  //--> *
                //read command
                byte serialData = Serial.read();
                //...Command  Logic....
               

if i uncomment the lines marked with  "--> * " the device works properly. I mean, it reacts all of the commands that pc send to it. I need to do some tests also this evening. and will report later. I think that this is related with transmission delay
... This is tricky because you have to know when the transmit buffer is empty and all of the last byte has been sent...
. ATmega328 works at 16MHz and it is faster than a 80286 smiley

For normal operation if a slave is requested to reply, it first pulls high the outputEnable pin and then sends the data. So even if i uncomment the
"--> * " lines MAX485 does not send any data to PC. Because the chip is in "Listening Mode"


Thank you for the answers
6  Using Arduino / Networking, Protocols, and Devices / Re: Mysterious RS485 problem on: May 15, 2011, 03:53:37 pm
Quote
When the computer wants to send data, Atmega328 doesn't understand the signal.
I think you are missing the point. On an RS485 bus there can only be one master. So if the Arduino is the master then for the PC to send data the Arduino has to request it, the PC responds and the Arduino receives it.
You seem to be implementing a multi master bus. RS485 is not designed to do this.

Do you mean that, although all devices are listening to the bus, the one which begins first to send data is the bus master and "others" are slaves, so even after receiving data and all devices begin to listen to the bus again, the one of the "others" cannot send data because it did not begin to send data first?

I planned the operation for the bus as half-duplex. Normally display devices don't send data to pc. They just receive. All the devices are listening to the bus.
7  Using Arduino / Networking, Protocols, and Devices / Mysterious RS485 problem on: May 15, 2011, 10:39:16 am
Hi,

I'm building a remote controlled display system. Multiple displays can be connected to a single, halfduplex RS485 line. The chip i'm using to interface RS485 is max485. The problem is, when arduino wants to send data (to be a busmaster) the computer receives it successfully. When the computer wants to send data, Atmega328 doesn't understand the signal. Thus cannot react.

Here is the configuration:
PC <==> FTDI FT232RL <==>MAX485 (this is a self made device - seperate from arduino)
     The TX pin is connected to pin4 (DI) of MAX485
     The RX pin is connected to pin1 (RO) of MAX485
     The RTS# pin is connected to pins 2 and 3 (DE/RE) of MAX485 (this pin is reversed with FTDI Util so now it is active HIGH)

ARDUINO <==> MAX485
     The TX pin(1) is connected to pin4 (DI) of MAX485
     The RX pin(0) is connected to pin1 (RO) of MAX485
     The 3rd pin(2) is connected to pin3 (DE) of MAX485 and pin2 (RE) of MAX485 is connected to gnd.

and the MAX485s are on the bus. Bus is terminated with a 330ohm res.

For the normal operation every device listens to the bus and arduinos are not sending any data. They only send data if debugging enabled. So for the operation, half duplex is enough.

When arduino wants to send data, it first sets the pin(2) (3rd pin) to high thus enabling the DE line of MAX485 Then puts the data on the bus. Since the computer listens data, it receives correctly but with 0 bytes at the end of transmission. The 0 byte is not a problem for now. When the computer wants to send data, it uses the same procedure. Pulls the RTS line High thus enabling the DE line and then puts the data on the bus. But no reaction from arduino. Without rs485, arduino is functioning correct.  No problem with the software in it. but when RS485 interface added this problem appears.

I've tried these to be the solution but none of them worked:
 1- To pull-up or pull-down the RX line of arduino -> NO Success
 2- Invert TX line of FT232RL -> NO Success
 3- Added 470ohm resistors to TX and RX lines -> NO Success

I dont have an oscilloscope so i connected an LED to RX line (RO line of MAX485 of arduino). It blinks when i try to send data from PC to arduino. So I think that the bitstream comes to the RX pin of arduino. (I cannot say that is correct bitstream but every datasheet or appnote states that ..if you do like this it works. But actually not.

Help is much appreciated. Thank you.

     

Pages: [1]