I'n new to the Edison world. I'm trying to write a hex value to the serial port and then waiting for the response. However apparently it is necessary to configure those pins first. Found some info on this forum on how to enable the Tx,Rx UART pins in the Edison board by writing shell scripts. I'm using the XDK, how can I do that from the XDK? It's possible? ...or how to do that? It's necessary to do that when using the Edison on the Arduino expansion board?
Thanks in advance!
If you are using the XDK, you can use the UART with the MRAA library. First, I suggest you to use the latest image and latest XDK. The XDK should be the 2571 (upper right corner of the XDK IDE) and the image is 159.devkit (run configure_edison --version in the Terminal Console).
Once you open the XDK you can choose one of the templates there, select the one named (UART) Serial Read/Write, that one will give you an idea on how to start. You could test it by wiring the Tx and Rx pins.
You can more information here:
http://iotdk.intel.com/docs/master/mraa/uart_8h.html UART.h File Reference
Thanks for the response! Well, that's exactly what I'm doing. I'm using the latest XDK and the MRAA library, wired the device to the Edison board TX/RX pins but apparently no data is being sent by the Edison board. I'm supposed to send a hex value requesting for a data stream (using write) and then listen for the response. However there's no response from the car's ECM.
All this is about reading a car's ECM data stream. May be I should ensure data is coming out the Edison pins in the first place. How can I do that?
Which expansion board are you using?
Which pins are you using?
Also, is the example that I mentioned before working?
You can check the output of the Edison by using a Logic Analyzer or an oscilloscope. You can also wire the Rx to the Tx of the Edison Module in order to check the output of the Edison
Thank you for the response.
>>Which expansion board are you using?
Arduino expansion board.
>>Which pins are you using?
0 and 1. Labeled RX and TX respectively.
>>Also, is the example that I mentioned before working?
Well, I noticed there's a template for UART usage, however how do I check if something is actually sent, That's part of the problem. It's possible to do some sort of loopback to check that? or how how can I check? Some simple resistor and led can do the trick? is the pin activation (via shell scripting) required?
You wrote: It's possible to do some sort of loopback to check that?
That's exactly what CMata_Intel meant by "You can also wire the Rx to the Tx of the Edison Module in order to check the output of the Edison"
I highly suggest you take this one step at a time. Verify there's an output on the Edison on the pin you expect, then if that makes it to the correct pin on the Arduino, etc.
One fundamental question: Is the physical interface between the car and the Arduino the same level? "Real" RS-232 (swings from -V to +V), or some variant?
Yep, you're both (Mata_Intel) right, I'll place a jumper to bridge those two pins together and check if something is coming out of them. I'll also build a small logic tester to check when everything is installed on the car.
>>Is the physical interface between the car and the Arduino the same level? "Real" RS-232 (swings from -V to +V), or some variant?
Well, it's supposed to be. The car's ALDL port is wired to a Maxim's 233 chip to convert to RS232 levels.
Stay tuned please, I'll try the loopback test after work.
I don't know how much you know about RS-232 so please bear with me.
RS-232 seems simple, but there are a lot of things to get correct.
- Baud rate
- Bits/parity/Stop bits (usually identified as "8N1", which means eight data bits, no parity bit, one stop bit)
- Flow control
- The physical layer (crossing the streams), see below:
(Hopefully I have all the details correct)
True RS-232 idles at negative voltage. With no data, a TXD line should sit at -3 to -8V or so.
So with your Arduino and the car NOT hooked up, you should be able to measure (with a scope or DVM) each RS-232's TXD pin and see that voltage. If the voltage is bouncing around it's possible the device is not "idle" and is instead, actively transmitting.
When you then properly connect one device's TXD (output) to the other's RXD (input), that negative voltage should remain.
One common problem with RS-232 is getting the TXD and RXD crossed (sometimes the manufacturer's labels are, ahem, misleading). If this connection is mixed up, you will not see that negative voltage on both interconnections. In fact, in this case (of miswiring) the two connected TXDs will show -V and the two connected RXDs will be floating (or some other unknown state).
(Note: In my experience, it's unlikely to have caused any harm by the way, to have them mixed up. It just won't work.)
Another experimental option would be to use a PC and terminal program to see if you can successfully identify the data. In this case pay particular attention to the flow control setting.
PS. Found this. http://www.connectworld.net/interface-troubleshooting.html RS-232 serial communication, RS-232 Troubleshooting, Standard RS-232 pin-outs
It's on the Internet so it must be true. LOL
Hi CMata_Intel and Mike-SYR,
Am trying to debug my uart communication by doing this "You can also wire the Rx to the Tx of the Edison Module in order to check the output of the Edison". But it seems not to be working out for me. Can please direct me on how to setup a simple code to write and read when the Rx and Tx is connected together?
Thank you in Advance.
I would like to know if you tried the loopback test and if you looked into the information provided for Mike.
Also, does the device/car you have use a specific communication protocol?
Yes, did the loopback test and it works! Used the UART template inside the XDK and just wired the Tx,Rx pins. The callback returns the data sent. Following Mike advice, I'm taking this a step at a time and performing tests as I go forward. Now that the Edison is sending and receiving data I'll test the RS232 circuit by sending the same data and checking if it goes out.
Next, will try to cmmunicate with th car's ECM. That will require a bit of trial and error since all I know is the ECM expects a string of hex values (something like F5400B8A1C) to start sending a stream of engine and transmission sensor data.(64 bytes ) however I don't know if it is necessary to send F5 first then 00, then B8, etc...
Stay tuned and will post the results next week.
Checked the RS232 circuit and a stream of data is going out. Not sure if the correct data or in the correct RS232 format (No access to oscilloscope) but something is going out as evidenced by a logic probe. Did receive data back, apparently not the one I expected to see but at least the car is communicating with the Edison board.
I'm going to analyse the received data to see if it is meaningful or if it is only random data. All I know is it looks like trouble codes, not sensor data stream. I'll keep experimenting and researching how to properly send the data stream request to the car PCM and in the proper format (hex required) as well as how to properly decode it back.
Will update the post in the following days.
Thank you all, and Happy 2016!!
The discussion is really interesting because I also tried using the UART and got a strange behaviour:
-Loopback works fine
-Tried using a Lora Module (http://www.disk91.com/2015/technology/networks/first-step-in-lora-land-microchip-rn2483-test/ First step in LoRa land – microchip RN2483 test " disk91.com – technology blog)
-->Lora Module did not work so tried several things, the conclusion is:
-the Intel Edison does not receive anything if send something to the module
-the Edison receives data if the commands are sent to the Lora Module from terminal (Realterm)
-a deeper analysis showed that the intel edison first sents an "FF" at the TX Pin?! (Maybe a problem with the Uart Init?!)
So refering to the topic it would be interesting to know if the UART works in your application
If not I suppose that your first received data is an error because the UART-Command is unknown
Unfortunately I had not time to fix the UART problem with the Lora module...
Have a nice day
Refering to the RN2483:
-the circuit diagram contains only the basics for the module (it was just a quick test, so only VDD, GND, TX, RX are connected)
-RESET Pin is floating (not the best idea, but it was just a quick test)
the hardware configuration of the RN2483 is not perfect, but it works completely with an FTDI using Realterm
so my idea was to use the Intel Edison instead of the FTDI, but I got the described problems
Maybe a better hardware setup can fix the problem, I will try in two or three weeks and post the results
(at the moment I am in the opinion that it is a software problem because the FTDI-communication is working correct)
Happy New Year 2016
Wow! Hope not having such issues. It turns out the RS232 serial interface output was connected on the wrong pin on the ALDL connector, Going to try again on a different pin after work and post the results.
Plugged the RS232 converter to the correct pin on the ALDL connector, run the code but no luck, just a buffer of random numbers. Discovered how to send the whole pack of hex numbers expected by the PCM using the buffer and also figured out how to decode the incoming buffer.
Next: surprise!! I'm receiving back the same data the Edison is sending!! just like the loopback test! I guess something is wrong with the RS232 interface circuit so a double check is in order.
Will be back with results....
Stopped using the RS232 circuit I've been using. Problem was Tx line was filled with Rx data and since it's event driven Rx pin was showing the Tx data. So ditched that circuit and used a 3-transistor design with a control pin to block data stream going into the Rx pin.
Edison board apparently does communicate with the car and the car responds with data, however somehow data isn't being read properly 'cause always get a rombus with a question mark, which I believe is an invalid character.
I'm stuck with this. I don't know if its something related to char encoding. Will try and post back results.