November 08, 2024, 10:34:23 PM

MOD-RS485-ISO

Started by centra, February 01, 2013, 03:08:00 PM

Previous topic - Next topic

centra

Hello!
We want to use the MOD-RS485-ISO to use RS485, as we were recommendet by our distributor. Unfortunately the device doesn't work. The signals from the RS485 are not put through to the RS232.
We never worked with OLIMEX-devices before, so what could be the problem?
The voltage is ok on both sides.

An other idea was, that the controller isn't preprogrammed, but I hope that this isn't the problem (we should have be informed about). Or do these products have to be programmed by the user?


We also just want to use the device as a RS232-RS485-Transceiver and not connect it to a development board from Olimex.


Thank you!

VernonB

I'm having similar problems with the MOD-RS485-ISO. I bought 50 of them unfortunately, and Olimex Support hasn't responded to my queries  >:(. I programmed a board with 'PIC-RS485.production.hex', from the MOD-RS485-ISO sub-project from the web. I can't see the board at 0XA0 or 0xFF using PICKit Serial Analyzer, so I'm stuck!! I suspect this board doesn't do true I2C, because if I try program the address into it, the PICKit Serial analyzer responds with "[S_][TX]00[Nr][STER]84[TX]FF[Nr][TX]A0[Nr][P_]", even at 40kHz I2C bit rate. Nowhere in the documentation is the bit-rate mentioned either, so I guess it's left to the poor users to figure out how to make this thing work....

LubOlimex

Hey guys,

Try programming the board with the latest firmware, direct link: https://www.olimex.com/Products/Modules/Interface/MOD-RS485-ISO/resources/MOD-RS485_firmware.zip . The I2C protocol is not "true", it is slightly modified, but still is I2C. To send commands to the board you should send 3 bytes of address, 1 byte for command and 1 for data.

For example if you want to open both TX and RX send the following:

0x48 – 0x04 – 0xA0 – 0x30 – 0x03

Where 0x48 is common address for Olimex I2C devices (This is 7 bit address, so if you want to write the first bit is 0x90),
0x04 – Address for all MOD-RS485-ISO devices,
0xA0 – This is the default address. This can be changed using commands.
0x30 – is the "set clc" command, RX and TX channels
0x03 – means both open.

Because we use modified protocol for our devices, usually the don't show up on different kinds of discovery. The board is tested with 100kHz I2C and should work.

Please let me know how it goes.

Best regards,
Lub/OLIMEX
Technical support and documentation manager at Olimex

VernonB

 :) Thanks, that works! In a future revision of the board, is it possible (maybe in firmware now), to RESET the MOD-RS485-ISO? (any spare lines on the UEXT?)

For the other querying party (centra), try this (for RX only):
void CommandSetClcRX(void) {
    char ack;
    Custom_SWStartI2C();
    Custom_SWWriteI2C(0x90); //OLIMEX  or, WriteByte(0x90);
    Custom_SWWriteI2C(0x04); // //MOD_RS485_ISO
    ack = Custom_SWWriteI2C(0xA0); // WriteByte(address);
    ack = Custom_SWWriteI2C(0x30); // SetCLC 
    ack = Custom_SWWriteI2C(0x12); //  WriteByte(2); 
    Custom_SWStopI2C(); // StopI2C();
    // return ack;
}

HFP

Quote from: centra on February 01, 2013, 03:08:00 PM
Hello!
We want to use the MOD-RS485-ISO to use RS485, as we were recommendet by our distributor. Unfortunately the device doesn't work. The signals from the RS485 are not put through to the RS232.
We never worked with OLIMEX-devices before, so what could be the problem?
The voltage is ok on both sides.

An other idea was, that the controller isn't preprogrammed, but I hope that this isn't the problem (we should have be informed about). Or do these products have to be programmed by the user?


We also just want to use the device as a RS232-RS485-Transceiver and not connect it to a development board from Olimex.


Thank you!


Quote from: VernonB on February 04, 2013, 12:23:28 PM
I'm having similar problems with the MOD-RS485-ISO. I bought 50 of them unfortunately, ...


Hello @ all,
I'm absolutely new here and an absolute beginner with Olimex UEXT interface boards, too. :-)

I also just want to use the MOD-RS485-ISO as a simple converter between UART (RX and TX connection to a FTDI 4-channel chip) and galvanic isolated RS-422 devices.

This should be an easy task but unfortunately there's nothing to see. :-(

Do I understand it right that I still have to program the MOD-RS485-ISO anyway before I can use it?

If so, how should I do this?

Any recommendations are very welcome! :-)

Thanks a lot in advance & best regards,
HFP

LubOlimex

Hey HFP,

Generally the OLIMEX devices are two types - host boards and extension boards. Extension boards have the MOD- prefix in their names. Extension boards are expected to be connected to the host boards. So with the host board you can send the commands explained in the manual via I2C (located on UEXT connector pins 5-6). More about UEXT: http://en.wikipedia.org/wiki/UEXT.

You don't have to program MOD-RS485-ISO if you are using common functions. Depending on the purchase date and/or distributor you might have the previous version of the firmware (boards sold/shipped before December 2012) and if that is the case you should refer to the documents in the previous versions of the demo code. The firmwares are located in the SOFTWARE section at this web-page: https://www.olimex.com/Products/Modules/Interface/MOD-RS485-ISO/.

Now if you are going for something special - aiming at timings, extra routines etc. you would probably need to edit for the firmware. The firmware is located on a PIC16F1503 microcontroller and MOD-RS485-ISO has ICSP 0.1'-step connector. This means if you wish to change the firmware you will need a PIC16F1503 compatible debugger - for example PIC-KIT3 (https://www.olimex.com/Products/PIC/Programmers/PIC-KIT3/).

Best regards,
Lub/OLIMEX
Technical support and documentation manager at Olimex

HFP

#6
Dear Lub,
Thanks a lot!

So now it's already much better for me to understand the basic conditions. :-)

I've never used Olimex host boards before, and I'm also not so much familar with MCU setups, but it seems that there are two possible options for me to get the UART interface connected:

1) enabling UART on every startup (done over I2C)

2) modifying the firmware to have UART enabled by default


Is this correct?

If so, it seems that I have to order the PIC-KIT3 as soon as possible, isn't it?

But the other option could be useful if I'll go for a host board. My target application is a system that should connect a PC application to a number of external sensor devices, maybe just 3-4 NMEA devices or up to 10-15 units. It could be useful to have something like an ARM board between all of these sensor devices, which could collect all external data and deliver it over only one further channel (e.g. USB or Ethernet) to the PC ...

Anyway, my primary task is just to have a reliable (isolated) connection to all of these NMEA (RS-422) devices.

That's why I'd still like to prefer the MOD-RS485-ISO! :-)

Best regards,
HFP

LubOlimex

Hey HFP,

Quote1) enabling UART on every startup (done over I2C)

2) modifying the firmware to have UART enabled by default

Is this correct?

Yes. This is correct.

QuoteIf so, it seems that I have to order the PIC-KIT3 as soon as possible, isn't it?

It seems likely, at least because we haven't tested the RS-422 communication (only RS-485). Remember the connector is 0.1' step.

About using a host board option:

It depends on the specific task but generally the I2C line while not very fast is capable of providing interface for many devices connected in parallel. What I mean is that on a single host board with UEXT you might have a number of MOD-RS485-ISO boards (each having your sensors).

A number of reliable ARM boards might be found in our ARM section. But I recommend you to take a look at the following boards:

https://www.olimex.com/Products/Duino/STM32/OLIMEXINO-STM32/
https://www.olimex.com/Products/ARM/ST/STM32-E407/
https://www.olimex.com/Products/ARM/ST/STM32-P107/

The A13 boards are also a good option for I2C communication - there are I2C drivers ready and working. You need to have a decent level of Linux experience before jumping there though: https://www.olimex.com/Products/OLinuXino/A13/A13-OLinuXino/ , https://www.olimex.com/Products/OLinuXino/A13/A13-OLinuXino-MICRO/.

Again, it all depends on the project. I don't recommend you buying anything before you are 100% sure you need it.

Best regards,
Lub/OLIMEX
Technical support and documentation manager at Olimex

harry85

Hi, i am trying to use RS485 TTL (no MODBUS) module to let two OLIMEX iso poe communicate with each other.
Somehow the RX and TX port is not recognized and I can not send a "ping" from TX to RX.

UEXT pins:
port 36 -> rx
port 4-> tx

or

no UEXT pins:
port 33 -> rx
port 32-> tx

While connecting the pins to each other over RS485 TTL module I used following code. Could you check to find out what is wrong in my code?

Thanks


TX code:


//#define TX1 4
//#define RX1 36
#include <Wire.h>
#include <MPU6050.h>
#include <ETH.h>
#include <SPI.h>
//#include <EthernetUdp.h> //Load the Udp Library
#include "Arduino.h"





//#define TX2 33  // ext2 pin 5
//#define RX2 35  // ext2 pin 3

int Enable_pin = 3;   // gpio -4  bei esp32 nodemcu  adc

void setup()
{
  Serial.begin(115200);       
  //Serial.begin(115200,SERIAL_8N1, 32, 33); 

  //Serial.begin(115200,SERIAL_8N1, 35,33);

  pinMode(Enable_pin, OUTPUT);

  delay(10);
  digitalWrite(Enable_pin, HIGH); 
}
void loop()
{

    Serial.print("ping");          //Serial Write ADC_Value to RS-485 Bus
    delay(100);
    //Serial.print("ping\n");          //Serial Write ADC_Value to RS-485 Bus
    //delay(100);
   
    }


RX code:
//#define TX1 4
//#define RX1 36
//#define TX1 4
//#define RX1 36
#include <Wire.h>
#include <MPU6050.h>
#include <ETH.h>
#include <SPI.h>
//#include <EthernetUdp.h> //Load the Udp Library
#include "Arduino.h"



//#define TX2 33   // ext2 pin 5
//#define RX2 35   // ext2 pin 3


int Enable_pin =3;  // gpio -4  bei esp32 nodemcu  adc
int led_pin = 15;
int i = 0;
const int frequency = 5000;
const int led_channel = 0;
const int resolution = 8;

char buffer[1000];
char buffer2;
byte state = 0;

void setup() {
  Serial.begin(115200);
  //Serial.begin(115200,SERIAL_8N1, 32, 33);
  //Serial.begin(115200,SERIAL_8N1, 35,33);
 
  pinMode(led_pin, OUTPUT);
  pinMode(Enable_pin, OUTPUT);
  digitalWrite(Enable_pin, LOW); //  (LOW to receive value from Master)

  delay(100);
}

void loop() {
  Serial.print("daten 0:");
  buffer2 = Serial.read(); // read data and write it to the buffer
  Serial.println(buffer2);

  if (Serial.available()) { // if any data came to the port
    delay(5); // wait a bit for the entire data packet to be accepted by the port
    Serial.print("daten 11:");
    buffer[i++] = Serial.read(); // read data and write it to the buffer
    Serial.println(buffer);

    while (Serial.available()) {
      buffer[i++] = Serial.read(); // read data and write it to the buffer
      Serial.print("daten 12:");
      Serial.println(buffer);
    }
  }

  if (i > 0) { // if there is something in the buffer
    buffer[i++] = '\0'; // convert the buffer contents to a string by adding a null character
    if (strcmp(buffer, "ping") == 0) { // if the accepted string is equal to the ping text
      Serial.print("####daten 3:");
      Serial.println(buffer);
      state = !state;
      i = 0; // reset the buffer index
    }
  }
}





LubOlimex

Which Olimex-made boards do you use? How are they named exactly?
Technical support and documentation manager at Olimex


harry85

do you have some advice for me? to proceed with the RS485 example?

thanks

Stanimir5F

Quote from: harry85 on September 20, 2023, 02:42:26 PMHi, i have the OLIMEX ISO POE IND board.

the RS485 module you can find here: https://www.reichelt.de/entwicklerboards-ttl-zu-rs485-max485-debo-rs485-ttl-p282703.html?PROVID=2788&gclid=CjwKCAjwsKqoBhBPEiwALrrqiHAHa4wjIVtrwUtwieIjQeoPMfMrwECj9z3_mKiWiNVDNdfG1uzE6BoCfxMQAvD_BwE



Hello, harry85!

We do have a similar module to the one you linked for which we have a library with examples:
https://github.com/OLIMEX/MOD-RS485-ISO/tree/master

You can check specifically the examples Receiver and Sender.

It has been done for another of our boards ESP32-EVB not ESP32-POE-ISO but the pinout of the UART pins on the UEXT is the same. So that should not be a problem.

Stan, Olimex
May the Source be with You!

LubOlimex

Why don't you try something simpler as a start (replace pins with yours) and in one board have SEND defined while in the other RECEIVE defined (comment/uncomment):

#define DE  XX
#define _RE YY

#define SEND    1
#define RECEIVE 0

#define MODE  SEND
//#define MODE  RECEIVE

void Enable (int Mode)
{
  digitalWrite (DE, Mode);
  digitalWrite (_RE, Mode);
}

void setup()
{
  Serial.begin (9600);

  pinMode (DE, OUTPUT);
  pinMode (_RE, OUTPUT);

  Enable (MODE);
}

void loop ()
{
  while (Serial.available() > 0)
    Serial.print((char)Serial.read());
}
Technical support and documentation manager at Olimex

harry85

#14
Hi thanks.

but where i need to define the Enable Pin (DE&RE) of RS485 module?
beacsue i need at least three pins TX, RX and Enable Pin.

this is the sender or TX code:


#define DE  4
#define _RE 36

#define SEND    1
#define RECEIVE 0

#define MODE  SEND
//#define MODE  RECEIVE

void Enable (int Mode)
{
  digitalWrite (DE, Mode);
  digitalWrite (_RE, Mode);
}

void setup()
{
  Serial.begin (9600);

  pinMode (DE, OUTPUT);
  pinMode (_RE, OUTPUT);

  Enable (MODE);
}

void loop ()
{

  Serial.print("ping");
  while (Serial.available() > 0)
    Serial.print((char)Serial.read());
}



and receiver or RX code:


#define DE  4  //TX
#define _RE 36 //RX

#define SEND    0
#define RECEIVE 1

//#define MODE  SEND
#define MODE  RECEIVE

void Enable (int Mode)
{
  //digitalWrite (DE, Mode);
  digitalWrite (_RE, Mode);
}

void setup()
{
  Serial.begin (9600);

  pinMode (DE, OUTPUT);
  pinMode (_RE, OUTPUT);

  Enable (MODE);
}

void loop ()
{

  //Serial.print("ping");
  while (Serial.available() > 0)
    Serial.print((char)Serial.read());
}



but somehow is not working ?