Pages: 1 [2]   Go Down
Author Topic: Mysterious RS485 problem  (Read 3384 times)
0 Members and 1 Guest are viewing this topic.
Offline Offline
Newbie
*
Karma: 0
Posts: 19
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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!
Logged

Offline Offline
Newbie
*
Karma: 0
Posts: 7
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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?
Logged

Offline Offline
Newbie
*
Karma: 0
Posts: 19
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Only sensor is connected, keypad and LCD are directly connected to the micro
Logged

Offline Offline
Newbie
*
Karma: 0
Posts: 7
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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
Logged

Offline Offline
Newbie
*
Karma: 0
Posts: 19
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Thnak you for the answer...but I tried and is still not working. It receives data for a while, while I am navigating through the menu is still receiving, but after some time the program stops, nothing works still
Logged

Seattle, WA USA
Online Online
Brattain Member
*****
Karma: 610
Posts: 49016
Seattle, WA USA
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Quote
It receives data for a while, while I am navigating through the menu is still receiving, but after some time the program stops,
You might be experiencing issues caused by not having enough memory. You need to post your code, so we can help you determine whether that is a possibility, or if there is some other issue.
Logged

Offline Offline
Newbie
*
Karma: 0
Posts: 19
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Maybe confused, but in fact I do not think memory is a problem, as after receiving each message and showing it I clear the memory corresponding to that variable...I am not sure if that is what you are talking about
Logged

Seattle, WA USA
Online Online
Brattain Member
*****
Karma: 610
Posts: 49016
Seattle, WA USA
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

All your variables, including arrays, take space in SRAM. So do all constants, like menu text. There is nothing you can do to free any of the space these things use. At best, you can be careful to never overwrite any arrays you have.

In spite of doing that, you can still run out of memory, if you have lots of text or arrays (especially large ones).

But, since your code is so secret, I guess we won't be able to help you. Sorry.
Logged

Offline Offline
Newbie
*
Karma: 0
Posts: 19
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Sorry about nor porsting my code, is part of a very big code and I was figuring out which parts could I post so as to make it clear. Anyway problem is solved, it was just that when I was receiving the message and press a key in the middle of the reception it could not receive properly anymore. I solved it using different interruptions and giving them priorities. Thanks anyway to those who helped!
Logged

Pages: 1 [2]   Go Up
Jump to: