Announcement

Collapse
No announcement yet.

Stange Serial Behavior

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

  • Stange Serial Behavior

    I am having some difficulty getting a new Rev1N uOLED-128 module to work with hardware and software that worked well with an older Rev1g uOLED-128 module. I'm not certain the new rev. is the source of my problems, but I think it's the only thing left. The trouble seems to be with the way my host MCU is initializing.

    Here is the initialization portion of my 4DGL code:

    func main()

    // Initialization Code
    media_Init(); // Initialize SD card
    gfx_Contrast(16); // Set contrast to full
    media_SetSector(0x0000, SPLASH); // Point to Splash Screen
    media_Image(0,0); // Show Splash Screen
    com_AutoBaud(5000); // Set baud rate
    com_Init(com_Buff, 10, 0x00); // Initialize serial communication

    // Main Code -> Infinite Loop
    repeat
    // Poll the status of the comBuff & wait for a full packet from host
    while ( com_Full() == 0 )
    pause(1);
    wend
    ...

    Here is the initialization portion of the host code:

    Start:
    ' Initiate peripherals
    PAUSE 100 ' To aid in Ign. Sw. debouncing
    IF IgnSw = 1 THEN ' Power-On Ignition Test
    LOW Light
    PAUSE 500
    HIGH Light
    PAUSE 250
    LOW Light
    PAUSE 250
    HIGH Light
    PAUSE 250
    LOW Light
    LOW Power
    SLEEP
    ENDIF

    HIGH Light
    HIGH Power ' Lock power supply on
    PAUSE 3000
    LOW Light
    PAUSE 500

    IF IgnSw = 1 THEN ' Interrupts not enabled yet and Ign.
    PAUSE 5000 ' SW may have been turned off.
    LOW Power
    SLEEP
    ENDIF

    TRANSMIT 0x55 ' Send screen auto-baud character
    SERIN Rx, BAUD, response, 5000, Main
    IF response = 0x06 THEN
    HIGH Light
    PAUSE 500
    LOW Light
    PAUSE 500
    ENDIF

    IF response = 0x16 THEN
    HIGH Light
    PAUSE 500
    LOW Light
    PAUSE 500
    HIGH Light
    PAUSE 500
    LOW Light
    ENDIF

    HIGH ConvS ' Initiate ADC
    LOW ConvS ' |
    PAUSE 1 ' |
    HIGH ConvS ' |
    ...

    When the module is plugged into the host MCU and the system is powered on, the screen will stay black until the MCU transmits the auto-baud character. I determined this by changing the pause interval during in the MCU's initialization code and noting that delay prior to the splash screen coming on correlates to the length of that pause.

    Further more, if I power up the system w/ the screen plugged in but the TX wire from the MCU removed, the screen will stay black until I reconnect the TX line.

    I'd start to cry about getting a defective screen, or wondering if I damaged it, but if i plug the screen into the uUSB-CE5 it behaves exactly like it should; it powers up and displays the splash screen indefinitely. If I interact with the screen through the terminal, it behaves perfectly. Clearly, the problem is on my end but I don't know what I'm doing wrong. It's interesting to note that I'm not getting an ACK or a NAK from the screen after the auto-baud character is sent.

    Any insight would be helpful.

    Thanks in advance,
    Brian

  • #2


    Can you ensure that you have the latest PmmC?

    There was an old issue that could cause that sort of behaviour
    Mark

    Comment


    • #3


      I loaded the latest (rev1h and higher, R22) PmmC this afternoon w/o any change in behavior. I just tried again to be sure and there wasn't a change...

      Will I brick my module if I try the 1g and earlier PmmC?

      I wasn't expecting a reply until Monday... very cool, guys.

      Take care,
      Brian

      Comment


      • #4


        The 1g PmmC wont brick it, but the display wont look right
        Mark

        Comment


        • #5


          I can't get my 1h display to lock up so everything appears to be working 'properly' in that regard.

          What happens if you replace the media stuff before the com_Autobaud with a print of some kind? Does it display?
          Mark

          Comment


          • #6


            Yeah, the earlier PmmC does look strange... I also tried an R21 PmmC that I found in the FAQ forum without any change.

            I tried your suggestion and tried this:

            // Initialization Code
            /*
            media_Init(); // Initialize SD card
            gfx_Contrast(16); // Set contrast to full
            media_SetSector(0x0000, SPLASH); // Point to Spash Screen
            media_Image(0,0); // Show Splash Screen
            */
            print("How about these apples");
            com_AutoBaud(5000); // Set baud rate
            com_Init(com_Buff, 10, 0x00); // Initialize serial communication

            // Main Code -> Infinite Loop
            repeat
            // Poll the status of the comBuff & wait for a full packet from host
            while ( com_Full() == 0 )
            pause(1);
            wend
            ...

            And got the same pause length before the text was flashed briefly and then a black screen.

            I should mention that I have a shut-down sequence programmed and 0s in the least 3 significant bits of first word in my comm buffer will trigger it. The shut-down sequence displays the splash screen for 3 seconds and 'properly' shuts off the screen.

            What seems to be happening is that the screen is showing black until the auto-baud and then I get the 3 seconds of splash screen in the shut-down sequence and then black again. Once I'm past the auto-baud, there is a short pause and then the host starts spitting out regular serial packets. Apparently I'm sending 0's with enough frequency to get this behavior almost all of the time.

            With the text, as shown above, the media and uSD initialization code is commented out, and the splash screen isn't shown in the shut down sequence. I just get a pause, a flash of text for a fraction of a second, and then dark...

            Comment


            • #7


              Can you check the voltage available when using the new and the old modules?
              Mark

              Comment


              • #8


                Er, kind of I left my DVOM at work and all I have at home is a DIY voltmeter that I never finished calibrating... I know it reads a couple of tenths low, and it says the Rev1N screen input voltage is 4.6 v. The last stage in my power supply for this circuit is an LM7805, and their output voltages are darn close to nominal.

                I can't check the Rev1G module because I blew it up, which is how I came to own this shiny new Rev1N module... I was making a new power supply circuit for the system and forgot the bootstrap diode on the voltage regulator. The first time it worked great. The second time I turned it on, I sent 7-7.5 volts downstream of the regulator and took out almost every IC including the screen. Anyway, I can't check the old module

                Comment


                • #9


                  I have a few more data points:

                  I just tried the same initialization code on a powered dev. board built by Parallax. I'm getting the same voltage reading and the same behavior. I'm pretty confident I can rule out the hardware of my project.

                  Additionally, if I hook up only the power and ground pins on the module and leave the RX and TX pins unhooked, nothing happens. This is true with the the regulated power from my Parallax dev. board, when powered by own hardware, and when powered by a bench power supply. This is not correct behavior, right? It seems like when power is applied to the module, it should power up and start executing code regardless of if the com. lines are hooked up.

                  Finally, the last data point is based on the following initialization code:

                  func main()

                  // Initialization Code
                  /*
                  media_Init(); // Initialize SD card
                  gfx_Contrast(16); // Set contrast to full
                  media_SetSector(0x0000, SPLASH); // Point to Spash Screen
                  media_Image(0,0); // Show Splash Screen
                  */

                  com_AutoBaud(5000); // Set baud rate
                  print("How about these apples");
                  com_Init(com_Buff, 10, 0x00); // Initialize serial communication

                  // Main Code -> Infinite Loop
                  repeat
                  // Poll the status of the comBuff & wait for a full packet from host
                  while ( com_Full() == 0 )
                  pause(1);
                  wend

                  ..........


                  As before, when I plug the module into a power source without the comm. lines hooked up, nothing happens. The screen stays dark. If I plug the module into my uUSB-CE5, I get a 7 or 8 second pause before the screen displays the text. I suspect the pause is the time it takes for the screen to start up plus the 5 second auto-baud time-out time. When I do this, the text will be displayed until I unplug the module.

                  Does the uUSB-CE5 do anything with the TX and RX lines when a module is plugged into it? I'm still a little learry about throwing 50 bucks at the problem to get another screen to test, but I think that's the only thing left...

                  Thanks for helping me diagnose this.

                  Brian

                  Comment


                  • #10


                    That is so odd.

                    Could you perhaps install a 10k resistor from RX to 3.3v, to see if that fixes it?

                    Could you take a closeup photo of the display's circuit board?
                    Mark

                    Comment


                    • #11


                      Okay, so I may have to revise those data points above on account of me being dumb... I reverted back to the initialization code in the original post and plugged into my bench supply and it worked like it should. I got a 1-2 second delay and then the splash screen until I unplugged the module. My bench supply is putting out 5.15V. That's measured with an off-the-shelf DVOM, not my hack job. I don't know why it worked this time, but I'm not ruling out the possibility that I didn't turn the power supply on after I hooked it up during my previous attempt...

                      That's good news, but I still have problems when I plug into the original hardware or my dev. board. Those output voltages are 4.94 and 4.96V, respectively. Pulling up the RX pin (pin 5) to 3.3V (pin 9) didn't solve the problem in either case, and yes, both power sources were on

                      I just measured the output of my uUSB-CE5 to be 4.98V.

                      I've attached a picture of the back of my module.

                      Thanks,
                      Brian Attached files

                      Comment


                      • #12


                        Sorry, I'm getting confused out of my little mind with all the changes.

                        Could you perhaps try a different make of uSD card? (some of them are pretty finnicky power wise)
                        Mark

                        Comment


                        • #13


                          Okay, so measuring the output of my USB port got me thinking... I built a LM317T based adj. voltage regulator into my power supply. I set the voltage to 4.94 and 4.96 volts and the screen worked both times. I set the voltage to 4.1 and, guess what, it powered on. I hate reverting to the supernatural for explanations, but I think my screen is possessed.

                          The power supply on the original hardware is a switch-mode power supply that feeds an LM7805. That power supply should be a rock. The regulator on my dev. board is an LM2940. For giggles, I measured the current draw of the module with the splash screen displayed at .04A. So I'm not asking either regulator to do something it can't...

                          I have no freaking clue... I swear I'm not yanking your chain

                          I'll bring all of this crap into work and see if one of the EEs there has any idea what's going on. No one will believe me unless I show them.

                          Thank you very much for the help, you've been great. I'll reply here if I find out anything worth while.

                          Brian

                          Comment


                          • #14


                            Sorry for the confusion. I'll try another uSD card, but this is the same card that was in the first module that I blew up. In fact, I got it from you guys when I bought the first module in 2008.

                            Comment


                            • #15


                              I scoped the power line to my screen at work today and found something pretty darn interesting. I've attached the scope traces that show what is happening on the power line when the various power sources that I've been using power up.

                              I know the above posts are super confusing; I was still figuring it out while we were conversing. I think this is the relevant information: My screen won't power on and display the splash screen if it's powered by either the circuitry I designed for this project or a dev. board made by Parallax. The output voltage of those two power sources is 4.94 and 4.96 v, respectively. However, if I power the screen from my bench supply at 4.96 V, it fires right up and I get the splash screen.

                              As mentioned, I've attached the scope traces of the 5V rail during power up. For both of the power supplies that don't work, there is a big, momentary voltage drop about 14 mS in. The spike is there when the module is powered by the bench supply, but it's amplitude is smaller. I also have a trace of the power line when the module is powered by my dev. board and I toggle the reset line; the spike is there as well.

                              I've also attached a photo that shows what I was scoping to be super clear about what I was doing.

                              I looked in the Goldelox data sheet but I didn't see anything about brown-outs or what the processor does to deal with it. I also don't know why my RevG module worked. I know that the screen changed between the two revs. Does the new one require a higher voltage step-up or something? Do I just need a big fat bypass cap across the screen power lines?

                              Thanks,
                              Brian Attached files

                              Comment

                              Working...
                              X