Posts: 9
Threads: 2
Joined: Jun 2011
2011-06-11, 02:11:02
(This post was last modified: 2012-12-22, 00:46:36 by Mikael Gustavsson.)
I am trying to use the GUI to download firmware to my board. I have it working perfectly with my board's RS-232 port using either a conventional serial port or a USB-to-RS-232 adapter. However, when I try to use a B&B Electronics USOPTL4 USB-to-RS-485/422 adapter to talk to my board's RS-422 port, it reports "The hardware detected a framing error." and "Found unknown device id(881) fw ver. 0.2.0" and aborts trying to connect to the BL. I know that the RS-422 adapter is working perfectly with two different dumb terminal programs and my board's RS-422 interface shares the same UART as the RS-232 interface and also works perfectly with the dumb terminals. The GUI correctly finds the RS-422 port reporting it as "RS-485 Isolated port (COM9)".
Do you have any idea what may be wrong?
Do you know of a USB-RS-422 adapter that is known to work?
Information on the RS-422 adapter is here:
http://www.bb-elec.com/product_family.as...lType=Main
Thanks,
John
Posts: 623
Threads: 0
Joined: Nov 2009
Hi,
Which firmware and version are you using?
Could you try a lower baud rate?
Posts: 9
Threads: 2
Joined: Jun 2011
The zip file that I downloaded was named ds30_Loader_110417.zip. I am using the firmware for the dsPIC33, and it was originally marked as version 4.0.0, although I had to change it to 2.0.0 when the GUI did not recognize the version. I read this solution in another post in the forums.
The GUI identifies as:
ds30 Loader GUI.exe 1.4.1.0
ds30 Loader.dll 2.0.1.0
GHelper.dll 1.0.5.0
devices.xml 2011-04-10
I am already running at 9600 baud, so the baud rate should not be an issue.
Both the RS-232 and RS-422 drivers are connected to the same UART on the dsPIC33 with one of the chip's outputs selecting one or the other.
Any ideas?
Thanks,
John
Posts: 623
Threads: 0
Joined: Nov 2009
You could try to add a delay after enabling tx.
Replace the code:
Code:
Send: ; Enable tx
.ifdef USE_TXENABLE
bset LATR_TXE, #LATB_TXE
nop
.endif
With, try with different values.
Code:
Send: ; Enable tx
.ifdef USE_TXENABLE
bset LATR_TXE, #LATB_TXE
mov 128,WTEMP2
dloop: dec WTEMP2,WTEMP2
cp0 W6
bra NZ,dloop
.endif
Posts: 9
Threads: 2
Joined: Jun 2011
Thanks, but I am not using 2-wire (half-duplex) RS-422. I am using 4-wire RS-422 which is full-duplex. I do not have a TX enable signal on my system since the transmit driver is always enabled.
In essence, the only difference between the RS-232 and RS-422 ports is the differential signals instead of the single-ended signals.
Any other ideas?
John
Posts: 623
Threads: 0
Joined: Nov 2009
Ok.
"The hardware detected a framing error." indicates a baud rate mismatch. Have tried a different baud rate or auto baud rate detection?
Are there any relevant erratas?
Posts: 9
Threads: 2
Joined: Jun 2011
I have not tried another baud rate. However, the same UART setup works perfectly with the RS-232 adapter. The only thing that's different is that I have a couple of I/O pins set to enable the RS-422 xceiver instead of the RS-232. In fact, I set it up to use the RS-422 port first and, while it's looking for a "hello" character, it also looks for a transition on the RS-232 xceiver. If it sees activity on the RS-232, it changes the I/O pins to enable the RS-232 xceiver. So everything from the point of view of the bootloader is the same for both interfaces.
What I think might be happening is that the RS-422 adapter may actually be reporting a framing error when it starts up. The dumb terminal program probably handles the error and continues. The GUI probably sees the error and aborts instead of clearing it and trying to continue.
John
Posts: 623
Threads: 0
Joined: Nov 2009
The framing message is just a notification. No action is taken (such as abort) when it happens.
Do you press write first and then reset the device? If so, please try the reverse, just press write
within the timeout, usually 2 or 3 seconds.
Posts: 9
Threads: 2
Joined: Jun 2011
Sorry, no joy.
If I reset my board and hit "Check for bl", it gives me the same error.
My board is intended for a use where the user will not have access to it to reset into the bootloader. I had to add some code to my application so that when it is desired to download new firmware, it enters a loop that will wait for the "hello" character and then, when it sees the "hello", it executes a software reset in order to run the bootloader. Then, when the GUI sends the "hello" again, the bootloader is running and communication is established. My code sees the "hello" and resets, but I still get the same error. If I use the RS-232 port, it works perfectly.
If the bootloader is not running, or the RS-422 is unplugged from the board, the "Check for bl" command retries until it times out and does not report a framing error.
If I look at the RS-422 signals with a scope, I see 0xc1 sent by the GUI. The bootloader responds with 0xc5, 0x02, 0x01, 0x4b. The GUI shows the framing error.
John
Posts: 9
Threads: 2
Joined: Jun 2011
Another update:
I rigged up an RS-232 to RS-422 level translator so that I could use the RS-232 port of my PC and connect it to the RS-422 port on my board. Everything is working perfectly.
There seems to be some problem between the USB-RS-422 converter and the GUI.
John
Posts: 623
Threads: 0
Joined: Nov 2009
I suggest you take a look at the signals with an oscilloscope.
Posts: 623
Threads: 0
Joined: Nov 2009
Posts: 9
Threads: 2
Joined: Jun 2011
(2011-08-09, 17:31:57)Mikael Gustafsson Wrote: Did you solve this?
Mikael,
I just tried your August, 8, 2011 release and it cured the problem! Many thanks!
I did not see any changes to the dsPIC33 code. Is that correct?
John
Posts: 623
Threads: 0
Joined: Nov 2009
Great! But a little weird...
There were no changes to any firmware.