Announcement

Collapse
No announcement yet.

ACK/NAK delay times

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • ACK/NAK delay times

    I am designing a small system for use in an automotive digital gauge application, using a PIC18F4520 and a uOLED-128-G1(SGC) display.

    I have everything working well using the ICD3 debugger and have added a uOLED-128-G1(SGC) kludge card to plug into the expansion bus in the Microchip PICDem2 Plus board.

    Unfortunately, the PICDEM2 plus board uses the TxD and RxD pins to drive a MAX3232 RS232 interface chip. The PIC RxD pin is experiencing a little contention between the MAX3232 chip and the uOLED-128-G1. However, the OLED module is more than capable of overcoming the contention and the system works very well. This contention will go away once my PCB design is done and everything is running on a real target system.

    I have been testing the system using a real time clock, and the system will typically run for days with no problem, but once in a while, it hangs up and everything stops running until the system is reset. The only places in my code where this can happen is in the subroutine that loops waiting for an ACK or NAK from the OLED module. I have not been able to get the system to fail when the debugger is connected (yet), so I can not confirm this is where it is hanging, but I strongly suspect it and believe the contention is the root cause.

    Since an automotive environment can be very noisy, and I can't afford to have these thing failing in customers' cars, I am trying to ensure that the system is as robust as possible.

    I use a subroutine that waits for ACK/NAK and then returns. I would like to add a timer to that subroutine that will return a NAK after a timeout if it hasn't seen an ACK or a NAK when it should. I can then have the software retry the command.

    In order to do this, I need to know the length of time I should wait for each command before I return the NAK.

    Has anyone characterized the length of time to ACK/NAK for different commands such as autobaud, clear screen, set opaque mode and text string display? I want to make sure my timeouts give the module enough time to finish its work.

    FYI, I will also be adding a watchdog timer to the code, but would prefer for that to not happen in the rare case where I miss an ACK/NAK.

    Thanks in advance for any information.

    Mark

  • #2


    Most commands have a pretty consistent time duration, of course the string commands vary accoring to the left of the string.

    Perhaps you could test all your commands using FAT Controller getting the times from it and use double that time?
    Mark

    Comment


    • #3


      I turned an LED on at the beginning of the WaitForAck routine and turned it off again at the end. I did that for the autobaud command, and hit reset and captured the LED output on my scope.

      The Autobaud command took a bit less than 200uS for the ack to come back.

      Then I wrote a loop to test each of the other commands:

      Clear Display took a bit less than 30mS.

      Set Opaque took a bit less than 550uS.

      To display 10 5x7 characters, 2x pixels on the top line took a bit less than 15mS.

      To display 5 8x12 characters, 3x pixels on the second line took a bit less than 25mS.

      So I think I will use a timeout of 50mS for my WaitForAck routine.

      Thanks for the idea.

      Mark

      Comment

      Working...
      X