
Modbus
#1
Posted 15 March 2011 - 07:49 PM
#2
Posted 16 March 2011 - 05:19 AM
#3
Posted 16 March 2011 - 07:20 AM
IMHO simpler way would be to utilize the existing RS485 mode of the USART, for example by adding a 'mode' property to the SerialPort class or to derive a new class. It would require change in the firmware: setting the USART_MODE field of the USART mode register (US_MR).I'd have implemented yet, but the RS485 interface requires a precise timing for the TX-Enabled line. ... I don't know if there is another simpler way.
#4
Posted 16 March 2011 - 07:52 AM
You're right, but it also depends on how you'd like to implement the RS485 driver.IMHO simpler way would be to utilize the existing RS485 mode of the USART, for example by adding a 'mode' property to the SerialPort class or to derive a new class. It would require change in the firmware: setting the USART_MODE field of the USART mode register (US_MR).
The Modbus spec says that you must use precise timing pre- and post-message. I took a look at the MCU specs, but it's not enough what it embeds.
By the way, even RS485 specs let you hold the linee with pull-up resistors, that is a very-economic way to solve the noise immunity. We have a long experience on very-noisy environments (with several meters of cable) and the resistors aren't absolutely enough. We are using taking the like busy some time before and after the message, so that the receiving uart can detect the real message with very few probability of errors.
Cheers
Mario
#5
Posted 09 June 2011 - 10:01 PM
#6
Posted 10 June 2011 - 07:46 AM
#7
Posted 13 July 2011 - 12:27 AM
but am experiencing many headaches. you know how it goes. you fight it for awhile then move to some other area of your project to help yourself feel like you are making progress.
right now it is working intermittently for me. i have sent data from Netduino+ to the BOB and seen it in hyperterminal (although dropping last byte somehow)
i have also sent data from hyperterminal to the netduino where it drops the first byte. kinda figuring something is not kosher there and its most likely the link between the keyboard and the chair.
the modbus/RTU device i try to talk to sends back 1-2 bytes of junk on a query. again not always reproducibly.
when i hook the device straight to a USB/RS485 and use the manufacturer's software it works well with no ill effects.
thinking there was a chance my shoddy soldering may have damaged the BOB. it looks ok, but i am running out of ideas as to where the problem is and am contemplating buying another one.
anybody have any suggestions?
#8
Posted 13 July 2011 - 04:00 AM
#9
Posted 15 July 2011 - 07:13 PM
#10
Posted 16 July 2011 - 04:25 AM
#11
Posted 17 July 2011 - 03:37 PM
#12
Posted 17 July 2011 - 04:03 PM
I really like hardware and software, since my childhood...this is only my real passion.
The opto-coupler is not mandatory, unless you will use the RS485 wiring along many many meters and/or noisy environs (bad grounding, electromagnetic emissions, big electric motors, etc)
From our long experience we learn that the most damaged part of a industrial system is just the RS485 interface. We always supplied with opto-coupler because is much more robust. By the way, when the wiring is 50-100 meters long, it is easy to have faults and blown during storms, for lightnings falling in the nearby. Lightnings are somewhat hard to protect from.
So, don't be in a hurry and wait before purchase any opto. You may do it later.
The RS485 driver is maybe the very first thing I tried to do with my Netduino, but it was totally unsuccessful. The Atmel chip has a "RS485 mode" itself, but it seems not allowable using the current framework. We should write a custom driver, but this is another (sad) task, hard to sort out.
Anyway, even the "RS485 mode" won't solve the goal.
The Modbus specs requires a precise timing before and after the byte stream. That is hard to reproduce, because the slowness and the background stuffs the framework has to do.
I guess there are only three solution for the Modbus with Netduino:
- someone will write a RS485 lo-level driver (using C/C++) and include it in the firmware;
- someone will create a "shield" hardware custom made for the RS485 RTU interfacing (so maybe the opto-couplers are embedded);
- avoid the RTU and use the TCP: that's the actual way I'm going to try.
You may also search for someone will borrow you a scope to check the signals, but once you have see they don't match the standard...what shall you do?
Cheers
#13
Posted 17 July 2011 - 04:52 PM
#14
Posted 20 October 2011 - 11:15 AM
#15
Posted 20 October 2011 - 11:57 AM
#16
Posted 20 October 2011 - 10:25 PM
#17
Posted 21 October 2011 - 03:09 PM
The TCP should going fine: is supported, and the Modubus/TCP is a well-known standard (de-facto).
Yeah, I´ve noted this after a bit more research...
About industrial env...
Well, the N is not targeted to work in industrial environments, but it also depends on what you mean...if you are looking for temperature range, certifications and whatever else, I guess Netduino is NOT the right choice.
On the other side, if the reliability is not a primary issue, and you are going to use a Netduino along some other good hardware (spikes protection, isolated I/O, etc), maybe could fit.
I´m not expecting a very heavy env, we planning in automate a lime mixer, there is no much to do (control 2 servos and watch 2 potentiometers, maybe 3), but they want to be able to control it in place and from distance, that´s why we´ve turned into Modbus idea, but it could be archived with another approach, just that Modbus is a standard way to do it.
My question on the industrial env is cause we can expect to have they running all days for long periods, it is much more cheaper then a CLP, and can do a great work on that project (I think at least). It will be inside a closed box and behind electrical protection for supply and I/Os for sure, it´s more a question on the durability, and stability I think. I don´t wanna then to be hanging after some hours of work, or need to change then after 6 months.
Looking at it´s components, I think the N+ don´t have much to be damaged (just by regular use), maybe the voltage regulators? Idk ... advises are vry welcome

#18
Posted 22 October 2011 - 04:37 AM
#19
Posted 24 October 2011 - 03:53 PM
No, I´m not in a hurry, we still planning on do that, checking if it will be a good idea to do it that way... but why? you made me curiousFirst question: are you in a hurry? I.e. could you consider thinking on within one month?

I´ve liked this idea, good oneI'd seriously consider some kind of watchdog, independent to the Netduino itself. It could be a simple monostable circuit (NE555 o similar), that must be cyclically reset, otherwise will reset the whole board.

Here we will do it the right way, with an emergency button that will shut things down in a "hardware" manner, avoiding any possible craziness from the softwareMoreover, if the safety of the served system is an issue, you should provide some way to "neutralize" a strange behavior of the Netduino. You may do it providing some hardware trick protecting from a Netduino driving crazy. For instance, if you were a heater and the Netduino will hang with the heater on, a safety trick would be detaching automatically the heater when it's on for a longer period.

#20
Posted 25 October 2011 - 07:04 AM
I am pretty busy, but I wish to complete my modbus/tcp porting. Once it will be working, you may use it.No, I´m not in a hurry, we still planning on do that, checking if it will be a good idea to do it that way... but why? you made me curious
I don't mean an "emergency" context, rather an hardware solution to keep the controlled system "safe" when the Netduino is out of service (no power for instance).Here we will do it the right way, with an emergency button that will shut things down in a "hardware" manner, avoiding any possible craziness from the software
It's common to provide a "system-halt" when the controller is off, otherwise the behavior could be unpredictable.
Cheers
1 user(s) are reading this topic
0 members, 1 guests, 0 anonymous users