Issues with COM1 through RS485 shield
#1
Posted 27 June 2011 - 09:47 PM
#2
Posted 27 June 2011 - 11:06 PM
- Luca Monaco likes this
#3
Posted 28 June 2011 - 05:28 AM
#4
Posted 28 June 2011 - 06:32 AM
#5
Posted 18 July 2011 - 03:22 PM
Hi Cinelli,Sorry, I did mean the Digital pins. Refernce this shield though we use others also:
http://tinyurl.com/3hodmg2
Thanks Chris, love the Netduino project and Secret Labs hardware.
I am very interested to this shield, but I never used it.
In shield documentation they said:
"The chip's DE (output enable) pin (3) is connected (via a resistor) to the Arduino's Digital Pin 2 - this is active high.
This DE pin is also connected to the chip's RE bar (receiver enable) pin (2) and therefore controlled by the Arduino's Digital pin 2 too - this is active low.
Arduino Digital Pin 2 = Rx/Tx 'Enable'; High to Transmit, Low to Receive"
So you have use also the Digital Pin 2.
Set it to true before trasmit data,
Set it to false after tasmitted data.
Let us know if it works.
#6
Posted 04 September 2013 - 08:26 PM
Hi, it looks like we are running into this or a similar problem with the http://linksprite.co...eld_for_Arduino shield. Can anybody provide more information or code? We've tested our code using an emulator and the rs485 device coms as well. The shield blips once TX but never receives a RX. Not sure yet how to debug this further. Any tips appreciated.
Thanks!
GG
#7
Posted 24 October 2014 - 10:59 PM
Hi all,
Did anyone ever figure this out? I've got a RS-485 Shield from LinkSprite and I can't get it work. Here are some details from my project:
1. Linksprite RS-485 Shield V2.1 - http://linksprite.co...2.1_for_Arduino
2. Using SerialPort for communication: http://msdn.microsof...y/ee432679.aspx
3. Communicating over CAT6 twisted pair to a device at other end expecting 9600 baud, Even parity, 7 character bits, and one stop bit.
4. Twisted pair inserted into H2 485-A and 485-B ports.
5. Netduino Plus 2 (bought a month ago with no firmware updates)
6. Set to 5V using jumper.
7. Set to D0 and D1 using jumper.
8. Set to TX_CTRL using jumper.
9. Plugged into computer to deploy code. Headers are not soldered but they fairly snug and not loose.
10: Code:
static SerialPort serial; static OutputPort led; const int bufferMax = 10000; static byte[] buffer = new byte[bufferMax]; static int bufferLength = 0; public static void Main() { led = new OutputPort(Pins.ONBOARD_LED, false); serial = new SerialPort(SerialPorts.COM1, 9600, Parity.Even, 7, StopBits.One); serial.ReadTimeout = 1000; serial.DataReceived += serial_DataReceived; serial.ErrorReceived += serial_ErrorReceived; serial.Open(); while (true) { { led.Write(true); Debug.Print("Request sent"); string hexrequest = "2F3F3030303330303030313039363030210D0A"; // Create request byte[] seq = StringToByteArray(hexrequest); if (serial.CanWrite) serial.Write(seq, 0, seq.Length); led.Write(false); } string line = "> "; for (int i = 0; i < bufferLength; i++) { line += buffer[i] + ","; } Debug.Print(line); if(serial.IsOpen) Debug.Print("Port is open."); Thread.Sleep(10000); } } static void serial_ErrorReceived(object sender, SerialErrorReceivedEventArgs e) { if (e.EventType == SerialError.TXFull) { Debug.Print("Error: TXFull"); } else if (e.EventType == SerialError.RXParity) { Debug.Print("Error: RXParity"); } else { Debug.Print("Error: Some other error"); } } static void serial_DataReceived(object sender, SerialDataReceivedEventArgs e) { Debug.Print(dataRecLineNumber + ": Data received ******* - " + t ); int bytesReceived = serial.Read(buffer, bufferLength, bufferMax - bufferLength); if (bytesReceived > 0) { bufferLength += bytesReceived; if (bufferLength >= bufferMax) throw new ApplicationException("Buffer Overflow. Send shorter lines or increase lineBufferMax."); } }
0 user(s) are reading this topic
0 members, 0 guests, 0 anonymous users