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!
After a lot of testing, I think, I've diagnosed the problem. Thing is, NodeJS Serialport library's .write() method is not sending any value equal or greater than decimal 128. My code looks like this (simplified):
serialPort.write(new Buffer([0xF4, 0x57, 0x00, 0x01, 0xB4]), function(err, results),,,
Meaning the car PCM expects value 0xF4 then 0x57 then 0x00 the 0x01 then 0xB4 to respond with a stream of 63 bytes of sensor values, however all it receives is:
# W# (replace the # with this): a rombus with a question mark inside. Every number greater than or equal to 128 decimal gets replaced by that symbol. Nor the zero or the 1 are either sent, so the car PCM understands nothing about what the Edison is trying to say and responds nothing. Tested connecting the Edison to a FTDI serial to USB cable back to the laptop and receiving the Edison values with XDK's own serial terminal, using PUTTY and a NodeJS program that wrote to read the serial port, all displaying the same results.
Your help will be very much appreciated.
I'm a bit uncertain what you are witnessing/reporting...
You say "all it receives is:" But what physical device is actually displaying this rhombus for you to see?
It looks to me like what ever it is, it's trying to interpret the hex values as ASCII. A 0x57 is a W in ASCII. So that appears fine.
But, the 0xF4 and 0x00 etc., cannot be rendered generally.
Can you switch the view to "Hex"?
>>"Tested connecting the Edison to a FTDI serial to USB cable back to the laptop and receiving the Edison values with XDK's own serial terminal, using PUTTY and a NodeJS program that wrote to read the serial port, all displaying the same results"
"Same" as in you are seeing the rhombus?
OR "same" as seeing what you are expecting?
>>"But what physical device is actually displaying this rhombus for you to see?"
A Laptop. I'm using the XDK to program the Edison, then wired the UART back to the Laptop via a FTDI serial to USB board, then reading the values with the PUTTY terminal, the XDK itself in the "Terminal tab" or a NodeJS program that wrote to check. All display the rhombus.
My feeling is same as yours. The laptop encodes the USB binary data back to ASCII to render on the screen. The Buffer object does accept encoding. Tried again specifying 'hex', 'utf8' or 'binary' (new Buffer(0xF4,0x57,0x00,0x01,0xB4), 'hex') and the laptop keeps receiving rhombus, W, rhombus which like you said, it's fine. Now all what's required is hook up back into the car PCM and perform some trial and error testing to check if the car responds or read the Edison outgoing UART data with anything else other than the PC and check for the actual binary data being sent (better more efficient approach)..
Thank you! Will come back with results.
OK, as long as you understand that issue - it can send folks new to the com port world into the weeds!
It would be good as you proceed to figure out how to see the hex.
I read this elsewhere...In PuTTY:
- Session | Logging
- Select All session output, then select save file.
- After saving the file, use any hex editor to see the result.
Still, there are com port interfaces that show hex natively. I'd have to dig to find one. And they may not be free. :-(