After a lot of troubleshooting, I finally figured out the problem. It
seems that The Link doesn't reset properly and I have to drop DTR&RTS to
cut its power and effect a full reset. Minicom does this, and that's why
using that worked, except when I'd exit minicom it spews its modem reset
which locked-up the Link agai, so I had to exit without modem reset (ctrl-a q).
When I power up the board, I can see that it has RTS&DTR powered (+5v).
Then I run the following little hacked-up program:

#include <sys/termios.h>
main(int argc, char**argv) {
  if (argc != 2) {
    exit(1);
  }
  printf("Dropping RTS&DTS on %s\n", argv[1]);
  int fd = open(argv[1], 3);
  struct termios tio1, tio2;
  tcgetattr(fd, &tio1);
  cfsetospeed(&tio1, B0);
  cfsetispeed(&tio1, B0);
  tcsetattr(fd, TCSAFLUSH, &tio1);
}

The sleep for a second or two and run owhttpd and it's all great. An
alternative was to add the equivalent functionality into ow_serial_open.c
with a static flag so it would only do this once and with a little sleep
added. But that's very hacky. I would recommend adding a "drop DTR&RTS"
routine into the failure handling, i.e., if the adapter doesn't open & reset
at the first attempt, then drop the power for 1-2 seconds before trying again.

In terms of troubleshooting, what tipped me off is that I was looking at a small
rs-232 tester with LEDs showing activity, and I'd see something sent from the
host to the Link but nothing coming back. This is a sign that the Link is in
some state where what it's being sent doesn't make sense to it...

Hope this helps someone...
Thorsten



------------------------------------------------------------------------------
Master Visual Studio, SharePoint, SQL, ASP.NET, C# 2012, HTML5, CSS,
MVC, Windows 8 Apps, JavaScript and much more. Keep your skills current
with LearnDevNow - 3,200 step-by-step video tutorials by Microsoft
MVPs and experts. ON SALE this month only -- learn more at:
http://p.sf.net/sfu/learnmore_123012
_______________________________________________
Owfs-developers mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/owfs-developers

Reply via email to