Announcement

Collapse
No announcement yet.

Limp/dead mode

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

  • tonton81
    replied
    last pic for now
    Attached Files

    Leave a comment:


  • tonton81
    replied
    I went to take some quick pics just now, ill be painting them once the clusters are done
    Attached Files

    Leave a comment:


  • tonton81
    replied
    For anyone interested, I finished fiberglassing the center portion of my dash with a 13.2" tablet, except for the exagerated size, it kinda looks OEM lol.., and soon going to be transferring the uLCD-70DT to the cluster, so fun stuff this fiberglassing

    Anyways, Here are 2 pics of the cable I have made and tested as per this thread discussion, all resisters are of course, 10K ohm, 3 wire to arduino, 2 wires to power source (this is presumed your arduino and power source have grounds already shared, in my case, the automotive field).

    Now you are able to turn on and off the LCD completely just by setting a digitalWrite HIGH(LCD OFF) or LOW(LCD ON) to it, without hindering the loop cycle speed of your microcontroller.
    This also deactivates the touchscreen as all lcd power is cut off, beneficial since false touches can be done if contrast was 0 (sleep mode)., also note, previously it was recommended to send the contrast level at a value once only,, which required more code and state machine. Now, just set it high or low in the loop, endlessly, this works fine and saves resources
    When powered back up, LCD will load it's default form obviously, you could use that as a splash page for your project, and have the form switch by microcontroller or by timer
    If your writing data to the first form immediately after powerup, you will see the data right away

    This cable has been tested using calculator demo without reset line or delays at 200000 baud, if you check, there is no reset line on the header
    For those who are curious, there will be a uUSB-PA5 programmer cable heatshrinked and sitting sparingly behind lcd, for the need to reprogram shall the need arise

    The ability to hot-plug gives us the capability to turn the lcd completely on or off without reloading the microcontroller (and create splash screens), for maximum energy saving and syncronized recovery
    Thanks
    Tony
    Attached Files
    Last edited by tonton81; 2nd November 2016, 07:23 AM.

    Leave a comment:


  • tonton81
    replied
    That reset, and full power, delay-less boot stuff is optional, of course, up to the end user to accomplish, other than ommitting the 5 lines above (and it's global RESETLINE variable)
    The benefit is for the end user who wants those additional features, but they won't work without the last library mod posted in post #22, and the 10k resistor pull-down mod (mandatory) in posts: 10, 24, and 26, depending on if your using a shield or not.
    Last edited by tonton81; 2nd June 2016, 09:31 AM.

    Leave a comment:


  • tonton81
    replied
    1) I did another test which tested the power down ability of the display, instead of sleeping via contrast 0, with the display still connected to the IO lines of the microcontroller, i drop just the power line (VCC) to display, making it turn off, good. Apply VCC back to the display, responds as expected as well. Used the calculator demo as a test to verify 2 way communication.

    So cutting power and applying power work, without restarting microcontroller code.
    This is also a benefit as powering off also disables the touch ability, preventing unnecessary taps or extra sleep forms being made for touch response.
    I've tested it using a PRMA1A05 reed relay, using a GPIO to power up/ power down LCD at will. Go green yay!

    2) Another test I will do is commenting out the RESETLINE and it's 100ms delay, to test HOST boot with LCD without resets

    Code:
    //  pinMode(RESETLINE, OUTPUT);  // Set D4 on Arduino to Output (4D Arduino Adaptor V2 - Display Reset)
    //  digitalWrite(RESETLINE, 0);  // Reset the Display via D4
    //  delay(100);
    //  digitalWrite(RESETLINE, 1);  // unReset the Display via D4
    //  delay (3500); //let the display start up after the reset (This is important)
    The Result: works as expected, using the calculator demo as a test

    It looks like we can gain an extra GPIO pin now for other use (instead of reset) on our precious MCUs

    These are still tests I'm doing based on the last mod, no current changes have been made since

    Also did a full HOST/display powerdown and startup using demo.

    As of now, theres only TX/RX,VCC, and GND from display for my tests
    The RESETLINE (since i am not using shield) is tied directly to VCC wire (always pulled high).
    For the SHIELD, if you really wanted, you could take the RES jumper off, and put a jumper wire from that middle pin and wire it to the VCC of the host to keep it always HIGH, so the display will be in a working state when powered.

    So, by freeing up the reset line in my tests, I am reusing the freed GPIO for the 5v reed relay which can fully turn on/off the lcd without touching the contrasts,
    benefit of this can also be less host code, as when setting a contrast it's recommended to set it once only not repeatedly, however, digitalWrite(4, HIGH) //(ON) and digitalWrite(4, LOW) //(OFF) is indeed a 1 line solution without flooding the UART line <-- this only happens when you dont do it once, setting a contrast in the loop repeatedly is really a waste of resources and may potentially cause overflow if the buffer isn't read on-time.


    Tony
    Last edited by tonton81; 2nd June 2016, 09:19 AM.

    Leave a comment:


  • James_4DSystems
    replied
    Looks like it is working well. Nice work.

    Leave a comment:


  • tonton81
    replied
    James, I have a gift for you, a good 2-way test using calculator demo, and hot plugging, no 3500 delay, and the loop() runs full speed no blocking, even without lcd

    https://www.youtube.com/watch?v=H_xb...ature=youtu.be
    Last edited by tonton81; 23rd May 2016, 11:51 AM.

    Leave a comment:


  • tonton81
    replied
    Here is the 2nd shield I have put the resistors on, this time not covering the printed labels, sorry i dont have any surface mount 10k ohms on hand :P

    Click image for larger version

Name:	IMG_2144[1].JPG
Views:	7
Size:	2.24 MB
ID:	52683

    Leave a comment:


  • tonton81
    replied
    RX1/TX1 of arduino hooked up using jumper wires with the modded shield:

    Click image for larger version

Name:	IMG_2142[1].JPG
Views:	7
Size:	2.43 MB
ID:	52668

    Leave a comment:


  • tonton81
    replied
    Click image for larger version

Name:	IMG_2141[1].JPG
Views:	9
Size:	2.37 MB
ID:	52666

    Here is the LCD shield mod, 2 x 10K ohm resistors to GND, you can wire your center pins of RX/TX to mega2560 RX1/TX1 port etc or put the jumper to use UART0.
    Tested and working using the original and modded library

    Leave a comment:


  • tonton81
    replied
    here is a 10 second unplug video i made for you: https://www.youtube.com/watch?v=VeD7...ature=youtu.be
    button pressing on corner of lcd reports object, index, and eventdata: https://www.youtube.com/watch?v=IktT...ature=youtu.be
    Last edited by tonton81; 22nd May 2016, 10:25 AM.

    Leave a comment:


  • tonton81
    replied
    you know what, i added the counter before i did the resistor mod, i just wiped it out and it works without it
    less code!

    Code:
    void Genie::WaitForIdle (void) {
        uint16_t do_event_result;
        long timeout = millis() + Timeout;
    
        for ( ; millis() < timeout;) {
            do_event_result = DoEvents(false);
            // if there was a character received from the
            // display restart the timeout because doEvents
            // is in the process of receiving something
            if (do_event_result == GENIE_EVENT_RXCHAR) {
                timeout = millis() + Timeout;
            }
    
            if (GetLinkState() == GENIE_LINK_IDLE) {
                return;
            }
        }
        while (deviceSerial->read() >= 0); // clear RX buffer
        deviceSerial->flush(); // clear TX buffer
        EventQueue.rd_index = 0; // flush EventQueue
        EventQueue.wr_index = 0; // flush EventQueue
        EventQueue.n_events = 0; // flush EventQueue
        Timeouts = 0; // reset Timeouts
        LinkState = &LinkStates[0]; // clear LinkState
        *LinkState = GENIE_LINK_IDLE; // set Link Idle
        Error = ERROR_TIMEOUT;
        handleError();
        return;
    }
    Looks like since the resistor fixed the timeouts, the buffer cleansing before hookup did the rest in the timeout section...

    this is the new files with counter removed, all functions tested still work as expected

    only the code above in green was added to the library, identifying it's purpose as well.
    Attached Files
    Last edited by tonton81; 31st May 2016, 09:32 AM.

    Leave a comment:


  • tonton81
    replied
    Code:
                 if ( genieErrorCounter> 10 ) {                genieErrorCounter= 0;
    This area here is where I did the event handler testing: This value is always 1 when data is sent to lcd, followed by idle link which returns it to 0. When the lcd is not connected, it keeps incrementing, so initially i set it 2. However, when testing event handler, it didnt work. When I increased the counter to a value of 10, event handler worked, so my guess is there is more increments when reading due to the frame data BEFORE the idle link is set. 10 seems to be more than enough as i am getting the object, index, and event data, and when the idle link is set, counter is reset before return;. seeing as I use this counter to prevent lockups, and the numbers can go up fast, if you do have event issues you could set it to 25 for example and it'll go away. Seems to process the RX data so, if you have issues with reporting, increasing this number will help and you shouldnt see any difference if you set it higher, i set it to 50 just now and there is no difference, the events come in, the counter is there just for protection
    Last edited by tonton81; 22nd May 2016, 10:01 AM.

    Leave a comment:


  • tonton81
    replied
    i keep 2 files in my folder, original and genieMod, if i need to test either of them, i just override and upload as needed, but the resistors are definately needed to make the library timeouts work

    Leave a comment:


  • tonton81
    replied
    yes, the event handler is working in this
    the buffer queue is wiped out when the timeout occurs (lcd missing), starts a new when connected. If this isn't done, the display doesnt run at full speed and potentially stall since the buffer has garbage in it

    yes, anything sent to display while it's disconnected is simply ignored and moved on without affecting your other code

    the timeout pretty much says that the display is not there, my idea was to attack that section and study it, print to monitor and see what is going on, I was going to monitor the ACKs for availability of display before processing code, but, after manipulating the timeout objects, they more or less do it inline without any extra code, however, like i said, the fall-out timeout does not occur mostly ever due to the fact that the uart sends garbage to the port from floating line that the library still tries to figure out, the resistors prevent that and actually make the original library (and the modded one) work efficiently and fixes the broken timeout function.
    Last edited by tonton81; 22nd May 2016, 09:41 AM.

    Leave a comment:

Working...
X