1. Join Now

    AVForums.com uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Strange RS232 problem

Discussion in 'TAG McLaren Audio Owners' Forum' started by Mike192, Apr 12, 2005.

  1. Mike192

    Mike192
    Active Member

    Joined:
    Jun 10, 2004
    Messages:
    58
    Products Owned:
    0
    Products Wanted:
    0
    Trophy Points:
    8
    Ratings:
    +5
    I seem to have found a strange problem with the RS232 ports on my AV192R. While trying to discover why a certain piece of equipment will not reliably receive RS232 commands from the AV192R I have noticed that the length of the stop bit at the end of each ASCII character is less than 1 bit duration. Screenshot 1 shows the start of an RS232 command with the stop bit indicated by the on screen markers. You can see it is about half a bit in duration (the baud rate is 9600). The AV192R is configured for 1 stop bit but I have found that configuring 1.5 or 2 bits doesn’t actually produce any change.

    This behaviour is the same on both the RS232 Input and Output ports. It is also the same regardless of whether the RS232 command is produced by relaying a received IR RC5 command or whether the command is generated using a macro.

    I have also found a second problem. When you generate RS232 commands using a macro you can select a delay between characters. If you configure delays below 10ms then no delay is produced, i.e. you get the half bit long stop bit followed immediately by the start bit of the next character. For settings of 10ms or more then a delay is produced. Screenshot 2 shows an RS232 command generated by a macro with a character delay of 9ms. Screenshot 3 shows the start of the same command with a delay of 10ms. Note that the delay for the first two characters is actually 5ms and it is then 10ms between the other characters.

    Any ideas? Steve maybe?
     

    Attached Files:

  2. GrahamMG

    GrahamMG
    Well-known Member

    Joined:
    May 8, 2004
    Messages:
    4,449
    Products Owned:
    0
    Products Wanted:
    0
    Trophy Points:
    86
    Location:
    UK
    Ratings:
    +192
    Blimey!

    That might explain why I gave up trying to get the pj to work via the AV192 over RS232, I have no idea if what we see is normal though. Steve :lease:
     
  3. Mike192

    Mike192
    Active Member

    Joined:
    Jun 10, 2004
    Messages:
    58
    Products Owned:
    0
    Products Wanted:
    0
    Trophy Points:
    8
    Ratings:
    +5
    Hi Graham,

    My PJ works fine via RS232. My commands are generated by macros which use the default 10ms inter-character delay. I guess it wouldn't work if I set the delay to zero.

    The problem I have now is that I am relaying received IR commands via RS232 and there is no way to configure a delay between characters.

    I have just imported the data from my scope into Excel and analysed it in more detail. The length of the "normal" bits is exactly correct for a baud rate of 9615. With the short stop bit (actually it is about 57% of a full bit) the "average" baud rate goes up to 10040. :confused:
     
  4. GrahamMG

    GrahamMG
    Well-known Member

    Joined:
    May 8, 2004
    Messages:
    4,449
    Products Owned:
    0
    Products Wanted:
    0
    Trophy Points:
    86
    Location:
    UK
    Ratings:
    +192
    Hiya.
    yes I used Macro's too.....
    I gave up on the IR bit as it was easier to use the Pronto direct and edit the IR codes in Pronto edit....... You can add delays between codes though in the Macro, at least I'm sure I could.... All my fustrations started when I tried to get the AV192R to talk to the Stewart screen via IR (don't ask), even using fully working AMX code libraries didn't work. Wrote my own IR code in the end (thanks to Stewart who sent the protocol) and banged it into the iPronto and chucked a wifi repeater in the hi-fi cabinet. Sledgehammer and nuts spring to mind but it all works fine now......
    Your findings are interesting though and I too wonder as to the answer.
     
  5. Stevesky

    Stevesky
    Active Member

    Joined:
    May 13, 2004
    Messages:
    454
    Products Owned:
    0
    Products Wanted:
    0
    Trophy Points:
    18
    Ratings:
    +13
    Tut Tut, slapped wrists! I've just had a look and it's a little buglette in the SCN2681 UART chip driver. It's got some hard coded test values in there and will be running the stop bit with 1/2 bit timing in it's current config independent on UI settings.

    Not too sure about the inter-character timing yet, that requires far too much digging for tonight. :eek:)

    Best bet is report the bug to IAG and in the meantime I'll send them a fixed driver for the UART.
     
  6. Mike192

    Mike192
    Active Member

    Joined:
    Jun 10, 2004
    Messages:
    58
    Products Owned:
    0
    Products Wanted:
    0
    Trophy Points:
    8
    Ratings:
    +5
    Hi Steve,

    It certainly is! I'll report the bug to IAG tomorrow and cross my fingers that we get an update soon.

    I guess the inter-character timing problem is something completely different that I stumbled across while trying to generate test commands to investigate the above problem.

    Many thanks for your usual excellent service. :thumbsup:
     
  7. Stevesky

    Stevesky
    Active Member

    Joined:
    May 13, 2004
    Messages:
    454
    Products Owned:
    0
    Products Wanted:
    0
    Trophy Points:
    18
    Ratings:
    +13
    Hi Mike,

    I know why the inter-character timing won't go under 10ms (apart from 0ms)... the sw timer used is the wrong one as it has 10ms resolution! Not the end of the world, but if I can find a few spare minutes I'll see if I can get it changed and again sent over to IAG so it can be included any new builds for the future.
     
  8. Mike192

    Mike192
    Active Member

    Joined:
    Jun 10, 2004
    Messages:
    58
    Products Owned:
    0
    Products Wanted:
    0
    Trophy Points:
    8
    Ratings:
    +5
    Hi Steve,

    That would explain it! Regarding the approx 5ms delay between the first two characters in my screen shot 3, would I be correct in guessing that this occurs because the delay between the first two characters is a fraction of the 10ms timer, depending on where this timer happens to be in its cycle when the first character is sent? If so then presumably this first delay will be random, anywhere between 0 and 10ms if a 10ms delay is configured in the menu. If I'm right then this could explain a problem I see very occasionally in which my projector doesn't respond to the RS232 command. I currently use the default 10ms inter-character delay for macro generated commands so I'll try changing this to 20ms and see if this particular problem goes away.

    The inter-character delay issue isn't too much of a problem now that we know what is happening as longer delays between characters generally don't cause problems. Using the inter-character delay feature should also allow you to get round the short stop bit problem for macro generated commands.

    The short stop bit problem is much more serious when you are relaying received IR RC5 commands as I am now trying to do. I've reported to bug to IAG and I hope they do release a fix soon.

    Thanks again for your help.
     
  9. Stevesky

    Stevesky
    Active Member

    Joined:
    May 13, 2004
    Messages:
    454
    Products Owned:
    0
    Products Wanted:
    0
    Trophy Points:
    18
    Ratings:
    +13
    Hi Mike,

    The first inter-char time will be fairly random due to this inherent 10ms resolution and how far into the 10ms we were when time was sampled. Once it gets shifted over to using the normal timer system then it will have about 2ms resolution in real terms. In your case pushing the inter-char delay upto 20ms should resolve your intermitency issue.
     
  10. edward

    edward
    Member

    Joined:
    Apr 2, 2003
    Messages:
    855
    Products Owned:
    1
    Products Wanted:
    0
    Trophy Points:
    32
    Location:
    Reading
    Ratings:
    +26
    And there I was, trying to figure out why I couldn’t get the RS232 output to operate my PJ.

    Does this explain why the output won’t even show up on a Windows Hyper Terminal session or is there another problem lurking here?
     
  11. Mike192

    Mike192
    Active Member

    Joined:
    Jun 10, 2004
    Messages:
    58
    Products Owned:
    0
    Products Wanted:
    0
    Trophy Points:
    8
    Ratings:
    +5
    Thanks Steve, just as I thought.

    Hi Edward,

    This could be the cause of your problem although it depends on how you are generating the RS232 commands. If you are using a macro with character delay set to the default 10ms or higher then the short stop bit shouldn't cause a problem (using 20ms as Steve suggests would be a good idea).

    I actually have no problems in receiving commands on a PC running Hyperterminal. Are you certain the wiring and COM port settings are correct? RS232 connections can be confusing!
     
  12. GrahamMG

    GrahamMG
    Well-known Member

    Joined:
    May 8, 2004
    Messages:
    4,449
    Products Owned:
    0
    Products Wanted:
    0
    Trophy Points:
    86
    Location:
    UK
    Ratings:
    +192
    Having looked at how I re-wrote the RC5 code to make it work, it is all in the timings to make it reliable....... Now I thought it was me and all the time it was Steve! SJ will also be happy as his AMX code is probably fine....

    Tut tut, 1 point deducted from genius level :D

    Thanks Mike....
     
  13. Stevesky

    Stevesky
    Active Member

    Joined:
    May 13, 2004
    Messages:
    454
    Products Owned:
    0
    Products Wanted:
    0
    Trophy Points:
    18
    Ratings:
    +13
    Not my code guvn'r, honest!!! I inherited this project from another team in a not too healthy incomplete state and had to get my guys to try and finish it off. Still, not an excuse for better testing though! ;o)
     
  14. GrahamMG

    GrahamMG
    Well-known Member

    Joined:
    May 8, 2004
    Messages:
    4,449
    Products Owned:
    0
    Products Wanted:
    0
    Trophy Points:
    86
    Location:
    UK
    Ratings:
    +192
    Like I said, 1 point deducted from genius level.....

    Any idea if and when we are getting the update (V4.4???). I'd love to know if it fixes what I was experiencing which sounds very likely...... Still I wouldn't have learned so much about RC5 if it has just worked first time....
     
  15. Mike192

    Mike192
    Active Member

    Joined:
    Jun 10, 2004
    Messages:
    58
    Products Owned:
    0
    Products Wanted:
    0
    Trophy Points:
    8
    Ratings:
    +5
    I've certainly learned a lot while investigating this problem. I would have found the answer much more quickly if I had put a scope on the output before now, but I was convinced that it was my fault so I continued to suspect my programing..............

    I reported the bug to IAG yesterday and Phil on the Helpdesk very quickly acknowledged my email. I hope there is an update and that we don't have to wait too long.
     
  16. Stevesky

    Stevesky
    Active Member

    Joined:
    May 13, 2004
    Messages:
    454
    Products Owned:
    0
    Products Wanted:
    0
    Trophy Points:
    18
    Ratings:
    +13
    I don't work for IAG and it's up to them if/how/when any updates are done. I don't mind help out a few TMA customers in my spare time if they have problems.

    Considering the software will need to change when the Audiolab versions of the TMA kit comes out (ie. replace all text of TAG McLaren with Audiolab) it may be a good time to incorporate any bug fixes in then. Of course it's all up to IAG.

    It's taken you guys nearly 2 years to discover it, so I think that's one point deducted for lousy beta testing! :eek:)))
     
  17. edward

    edward
    Member

    Joined:
    Apr 2, 2003
    Messages:
    855
    Products Owned:
    1
    Products Wanted:
    0
    Trophy Points:
    32
    Location:
    Reading
    Ratings:
    +26
    Thanks Mike.

    Yes, I've tried 2 to 3 and 2 to 2 and it still doesn't seem to work

    I'm using a macro - the same one that raises and drops my screen - and that bit works well.

    I'll have a shot at the 20 mS delay and see if that changes anything for me.
     
  18. Mike192

    Mike192
    Active Member

    Joined:
    Jun 10, 2004
    Messages:
    58
    Products Owned:
    0
    Products Wanted:
    0
    Trophy Points:
    8
    Ratings:
    +5
    Hi Edward,

    It sounds like you are doing the same as me. I have a macro that drops the screen and blinds (using action switches) and then sends an RS232 command to the projector to switch it on. This works fine for me except for very rare occasions when the screen drops but the projector doesn't switch on. It now seems that this could be due to the inter-character delay problem.

    What puzzles me about your problem is that you see nothing on a PC running Hyperterminal. A problem in the macro or the inter-character delay bug could explain why the projector doesn't respond but you should still see some ASCII characters being received by Hyperterminal. The fact that you don't suggests that something more fundamental may be wrong.

    By the way I live in Bracknell, not far from you, so if you continue to have problems I would be happy to come over and see if we can sort it out together.
     
  19. edward

    edward
    Member

    Joined:
    Apr 2, 2003
    Messages:
    855
    Products Owned:
    1
    Products Wanted:
    0
    Trophy Points:
    32
    Location:
    Reading
    Ratings:
    +26
    Many thanks. I'll PM you.
     
  20. edward

    edward
    Member

    Joined:
    Apr 2, 2003
    Messages:
    855
    Products Owned:
    1
    Products Wanted:
    0
    Trophy Points:
    32
    Location:
    Reading
    Ratings:
    +26
    BTW: Is the DB9 - DB9 lead expecting 2 and 3 to be crossed over?
     
  21. Mike192

    Mike192
    Active Member

    Joined:
    Jun 10, 2004
    Messages:
    58
    Products Owned:
    0
    Products Wanted:
    0
    Trophy Points:
    8
    Ratings:
    +5
    It depends on whether you are using the RS232 Input or Output on the AV192R. The AV192R output port is wired like a PC (DTE) and I guess your projector is probably wired like a modem (DCE) so you would use a straight through cable. If you are using the input port on your AV192R this is wired as a DCE so to connect it to another DCE you need to use a cross over cable.

    Which ever port you use on the AV192R to connect to your projector, when you substitute a PC for your projector to test with HyperTerminal then you will probably need to swap the cable for the opposite type (i.e. straight through changes to crossover and vice versa).

    I hope this makes sense!
     
  22. edward

    edward
    Member

    Joined:
    Apr 2, 2003
    Messages:
    855
    Products Owned:
    1
    Products Wanted:
    0
    Trophy Points:
    32
    Location:
    Reading
    Ratings:
    +26
    This has me scratching my head.

    If I'm outputting on both send and recieve ports of the AV192R, I'd have thought they'd be the same - DTEs.

    I would also have though the PJ would be DTE as well, which is why I assumed 2 and 3 were crossed in the cable.

    Shows how little I know of comms - which is probably why this has given me
    so much grief.

    PM sent BTW.
     
  23. edward

    edward
    Member

    Joined:
    Apr 2, 2003
    Messages:
    855
    Products Owned:
    1
    Products Wanted:
    0
    Trophy Points:
    32
    Location:
    Reading
    Ratings:
    +26
    Ha! Sorted!
    With Mike’s help we established that:
    - the cable needed to be wired as null-modem for my PJ – I had it as modem
    - the 20 mS delay means the characters are detected on a hyper terminal session
    - positioning the command at the top of the list makes a difference
    - macro 0 (previously my OFF command) is temperamental about taking commands (seemed OK last time but today…)
    - it was a great day for a romp to a country pub in a TR6.

    What a clever piece of kit that AV192R is!
     
  24. Mike192

    Mike192
    Active Member

    Joined:
    Jun 10, 2004
    Messages:
    58
    Products Owned:
    0
    Products Wanted:
    0
    Trophy Points:
    8
    Ratings:
    +5
    It may be worth mentioning that in addition to the unit's refusal to accept an entry of 31 0 for a chained macro, we also got a lock-up situation at one stage in which the AV192R stopped sending RS232 commands to my laptop. We did a power off-on cycle and it then sprung back into life.

    My car seemed very quiet on the drive home. I'm don't know if my ears were numb from the lovely sound of the TR6 engine or whether it was the after effects of your sound system demonstration!
     
  25. GrahamMG

    GrahamMG
    Well-known Member

    Joined:
    May 8, 2004
    Messages:
    4,449
    Products Owned:
    0
    Products Wanted:
    0
    Trophy Points:
    86
    Location:
    UK
    Ratings:
    +192
    The TR is a couple of cylinders short of a proper noise :rotfl:
    What is it with owners of TAG kit and fast old sports cars, the two always seem to go together :smashin:
    I assume Edward's subs are still undoing the bolts holding the rear speakers to the wall....?
     
  26. Plump

    Plump
    Standard Member

    Joined:
    Feb 22, 2002
    Messages:
    636
    Products Owned:
    0
    Products Wanted:
    0
    Trophy Points:
    19
    Location:
    under the bridge
    Ratings:
    +0
    Graham, do you actually know anyone having TMA1?
    I am playing with thoughts to try to find one to play with, but you know...
     
  27. GrahamMG

    GrahamMG
    Well-known Member

    Joined:
    May 8, 2004
    Messages:
    4,449
    Products Owned:
    0
    Products Wanted:
    0
    Trophy Points:
    86
    Location:
    UK
    Ratings:
    +192
    The TMA1 is basically the same unit as used within the AV192R and I know several people with that one! I assume they actually sold some TMA1's so it shouldn't be an issue getting it to work the same as the inbuilt unit unless anyone knows differently?
     
  28. Plump

    Plump
    Standard Member

    Joined:
    Feb 22, 2002
    Messages:
    636
    Products Owned:
    0
    Products Wanted:
    0
    Trophy Points:
    19
    Location:
    under the bridge
    Ratings:
    +0
    That was the reason I asked, I namely never heard anyone having one.
    Who knows, maybe HifiBitZ gets some :)
     
  29. GrahamMG

    GrahamMG
    Well-known Member

    Joined:
    May 8, 2004
    Messages:
    4,449
    Products Owned:
    0
    Products Wanted:
    0
    Trophy Points:
    86
    Location:
    UK
    Ratings:
    +192
    Moving fingers one to the right to get spelling correct.......... I nearly bought one but bought a full house AV192R instead!!!
     
  30. Plump

    Plump
    Standard Member

    Joined:
    Feb 22, 2002
    Messages:
    636
    Products Owned:
    0
    Products Wanted:
    0
    Trophy Points:
    19
    Location:
    under the bridge
    Ratings:
    +0
    Yes, someone might call that "buying" too, I mean prices you payed ..... :D :rotfl:

    Same as these DPs recently. I hate myself, I payed full price for my DP. I hate myself I hate myself I hate myself I hate myself I hate myself I hate myself I hate myself I hate myself.....................
     

Share This Page

Loading...