New USB-Loconet interface

Liviu M
Posts: 932
Joined: 03.12.2011, 20:44

Post by Liviu M » 05.03.2013, 23:04

Hello Peter,

I think I have an working "echo" version. Please try the attached firmware (echo3); you should select the ULNI Loconet controller.

I hope it works for you also; if not, I'll try further.

Regards,
Liviu
Attachments
ln2usb_2550_echo3.hex.txt
(25.9 KiB) Downloaded 36 times

rjversluis
Site Admin
Posts: 41142
Joined: 10.04.2006, 08:48
Location: Speyer, Germany
Contact:

Post by rjversluis » 06.03.2013, 08:29

Hi Liviu,

I got a test version from Peter but the Digitrax DCS100 does not communicate with this USB interface; Maybe your Loconet timing is out of spec...

Make sure your bit time is exact 60.0 uSecs.
NETWORK Timing:
LocoNet® data is sent in normal ASYNCHRONOUS format using 1 START bit, 8 DATA bits and 1 STOP bit. The 8 bit data is transmitted LSB first. The bit times are 60.0 uSecs or 16.66 KBaud +/- 1.5%. A PC serial "COM" device can use the convenient rate of 16.457 KBaud. This corresponds to a
Divisor of 07 for the standard NS8250 UART chip or equivalent used by most compatibles. Bytes may be transmitted "back-to-back", with a Start bit immediately following the Stop bit of the previous character.

ron&bram
Posts: 2460
Joined: 11.06.2008, 19:34
Location: Heemskerk, Netherlands

Post by ron&bram » 06.03.2013, 09:04

Hi Liviu,

I also have a test version from Peter, in combination with an IB1/TC. I can do firmware updates using ISP connector, GCA153 and ICProg program.

Liviu M
Posts: 932
Joined: 03.12.2011, 20:44

Post by Liviu M » 06.03.2013, 09:52

Hello Rob,
rjversluis wrote: Make sure your bit time is exact 60.0 uSecs.
Theoretically is what I've implemented. Practically it is one of the reasons I've migrated to the hardware USART port of the PIC (see the sixth post on the first page of the topic), in the hope the communication will be more robust.
I don't know the reasons Peter has choose the "soft USART" version, I was trying to help him with an working firmware, but if this "echo" version works I was planning to:
- implement the echo mechanism in the "hard" version
- ask Peter to switch to this "hard USART" version *)
Unfortunately I doesn't knew Peter has done more boards which should be modified. :(

*) since the Peter's original design was a combination of the two versions, I think the changes are quite easy to be implemented:
- solder all components (both the T1 & T2 transistors and all four resistors - R7, R10, R12 & R14)
- move the LN_IN connection from pin 21 (RB0) to the pin 18 (RC7/RX)
- move the LN_OUT connection from pin 22 (RB0) to the pin 17 (RC6/TX).
- use a new firmware (not yet available, but coming).

Hello Ron,
Have you tested the interface? Do you have problems also?
You are, of course, welcome to use the new firmware versions. Please made public any problems you encounter.

Regards,
Liviu

ron&bram
Posts: 2460
Joined: 11.06.2008, 19:34
Location: Heemskerk, Netherlands

Post by ron&bram » 06.03.2013, 10:35

Hello Liviu,

I had send my comments directly to Peter. Normally, I use a GCA85 for the pc-loconet interface, with a Twincenter. The only difference I could find between using the GCA85 and the GCA172 was when quitting Rocrail. With the GCA85 my Power7 booster connected via the TC loconet-B connector turned off power correctly. With the GCA172, the TC turned off power, but the power of the booster stayed on. When running the layout, I observed no problems with the GCA172/TC combination.

Liviu M
Posts: 932
Joined: 03.12.2011, 20:44

Post by Liviu M » 06.03.2013, 11:19

Hi Ron,

except a timing problem (in my interface), I can't see any reason for the described behavior (the TC & booster are receiving both the same "POWER OFF" command).
I'll try to look at the waveforms using an oscilloscope, maybe I'll fix also the Rob's problem.

Regards,
Liviu

phg
Posts: 337
Joined: 23.02.2008, 20:55
Location: Deventer Niederlande
Contact:

Post by phg » 06.03.2013, 14:11

Hello Liviu,

I agree with you to use hardware Uart.
I used software Uart because that was your original first schematic.
You used LM339 there also for sending, which ist basicly making life very easy, but I have some objections about the maximum current of 16 mA.
So , to be in phase with LocoNet, I put an extra transistor in TX circuit.
Furthermore, there might be a catch on this.
As far as I know, LocoNet assumes an option to check the logocal state of the LocoNet line. That could be hard when using hardware Uart.
Therefore , as you can see in the schematic, I left the connections with RB0 and RB1 alive, and added D3+D4 giving an option to 'block' LocoNet line if that is needed.
If it is not necessary in your option . just leave RB0 and RB1 as input.
Attachments
GCA172_sch_v11.pdf
(586.45 KiB) Downloaded 66 times

Liviu M
Posts: 932
Joined: 03.12.2011, 20:44

Post by Liviu M » 06.03.2013, 14:46

Hello Peter,
phg wrote: I agree with you to use hardware Uart..
OK, in this case please test the new firmware and, if it works for you with the "echo option" in "ULNI mode", I'll update the hard-USART version as well.
phg wrote: You used LM339 there also for sending, which ist basicly making life very easy, but I have some objections about the maximum current of 16 mA.
You have a point here, except that is not maximum, but typical. But as long the minimum "good" out current is 6 mA, it seems a bad choice for a "series" product.
phg wrote: Furthermore, there might be a catch on this.
As far as I know, LocoNet assumes an option to check the logocal state of the LocoNet line. That could be hard when using hardware Uart.
Can you, please, explain a little bit more in detail or point me to the right documentation? Maybe I can find a way to implement it.

Regards,
Liviu

ron&bram
Posts: 2460
Joined: 11.06.2008, 19:34
Location: Heemskerk, Netherlands

Post by ron&bram » 06.03.2013, 15:37

Hi Liviu,

I could not think of an explanation for the different behaviour of the TC and the booster either, especially since it only happens when terminating Rocrail. If I turn off/on power in a running Rocrail session, both TC and booster power off/on.

phg
Posts: 337
Joined: 23.02.2008, 20:55
Location: Deventer Niederlande
Contact:

Post by phg » 06.03.2013, 16:39

Hello Liviu,

On the LocoNet issue, I have to refer to Rob, he does know much more about what is needed.
I will ask Rob for it.
I thought that LocoNet needs a way of checking if the line is free to send something. And that can be hard to do if the RX-port is set as RX.
So with that situation, it might be convenient to check that state with RB0.

As soon as I made new board, I will check firmware. Thanks.

rjversluis
Site Admin
Posts: 41142
Joined: 10.04.2006, 08:48
Location: Speyer, Germany
Contact:

Post by rjversluis » 06.03.2013, 16:55

Its all in the Loconet Personal edition documented:

http://wiki.rocrail.net/lib/exe/fetch.p ... dition.pdf

Just search for "NETWORK Access:"

Liviu M
Posts: 932
Joined: 03.12.2011, 20:44

Post by Liviu M » 06.03.2013, 18:19

Hello all,

I've succeed to update the hard-usart version also. The firmware is attached - the ln2usbUsart_2550_echo.hex.txt file.

@Peter: the hard-usart version doesn't need any trick to correctly function in the Loconet. For these purposes I've used the second comparator, to transform the TX port from PUSH-PULL to open-collector. In this way the Loconet is not disturbed (is no difference between saying Locobuffer and this interface).

@Rob: attached is also a version with better timings. As long as Peter plan also to move to the hard-usart version, I'm not sure if testing this version make sense, but if you want to play please use the ln2usb_2550_echo_timing.hex.txt file.

@Ron: I couldn't see any real problem with the timings. However, if you want, you can try the ln2usb_2550_echo_timing.hex.txt file too.

Regards,
Liviu
Attachments
ln2usb_2550_echo_timing.hex.txt
(25.83 KiB) Downloaded 35 times
ln2usbUsart_2550_echo.hex.txt
(24.65 KiB) Downloaded 31 times

ron&bram
Posts: 2460
Joined: 11.06.2008, 19:34
Location: Heemskerk, Netherlands

Post by ron&bram » 06.03.2013, 19:32

Hi Liviu,

Waste no time on what I found when quitting Rocrail, normal power off/on works.

What must I do to test the hardware UART version (I know enough of the difference between the business end of a soldering iron and the handle to assemble my own GCA modules, but I am no electronics expert or so)?

Liviu M
Posts: 932
Joined: 03.12.2011, 20:44

Post by Liviu M » 06.03.2013, 19:34

Hello Peter,

I think I've misinterpreted your concern about the hard usart port & loconet. More than that, I think in the actual version I have a little problem here (I'll correct it the next days), but I can handle it in code, I don't think you/we need extra hardware for it.
On the other hand, the place for two diodes is not so big. If not needed, they can remain unsoldered (just a bridge for the one on the rx pin).

Regards,
Liviu

Liviu M
Posts: 932
Joined: 03.12.2011, 20:44

Post by Liviu M » 06.03.2013, 19:57

Hello Ron,

You should:
- solder all components (both the T1 & T2 transistors and all four resistors - R7, R10, R12 & R14) - see the schematic Peter posted on first page of the topic. I hope Peter doesn't changed it.
- move the LN_IN connection from pin 21 (RB0) to the pin 18 (RC7/RX). With moving I mean 'cut the pcb wire connecting the pin 21 with the pin 7 of ther lm311 and connect the PIC's pin 18 to the pin 7 of lm311 with an extra wire'.
- move the LN_OUT connection from pin 22 (RB0) to the pin 17 (RC6/TX). Same procedure - cut the pcb connection between the pin 22 and resistor R4 and connect the pin 17 with the R4 - the terminal previous connected to pin 22.
- use the corresponding firmware. I think the one I've just posted above works, but the next time I'll post a new one slightly improved.

If you don't want to loose the board warranty, :mrgreen: just wait the next firmware (I discovered I should implement the Peter's suggestion). In this case you do not cut anything, but just short-circuit the pins 21 with 18 and 22 with 17.

Regards,
Liviu

Post Reply

Return to “DIY Hardware”