Announcement

Collapse
No announcement yet.

Comms Init needs a physical power off/on (ulcd to Nano)

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

  • Comms Init needs a physical power off/on (ulcd to Nano)

    I have a project which works simply by using a serial buffer and receiving data from an arduino nano.

    The Two devices work when when connected via to the computer (usb) and the ULCD connects and does its thing (running nano TX to ULCD TX1)

    However, when i move away to a self powered environment, The ULCD seems to have problems reading data into the buffer.

    both devices work of same power source and grounds, and both boot at same time.

    Once in maybe 5 or 6 power ups will the ULCD communicate.

    One thing i have noticed, if i disconnect power from the ULCD (while nano is powered) then everything works fine????

    any ideas??




  • #2
    where is your code? did you add the reset logic before communicating to the lcd? are the grounds shared?

    Comment


    • #3
      Its on my computer at home. ULCD is powered from the Nano so yes they share same grounds and power source.
      Adding a delay before sending data from Nano, or a delay before/after reading coms buff on ULCD does not help.
      Both baud rates are the same.
      As said it will work if i disconnect and reconnect the power to ULCD but very rarely will work when both boot together.
      Also i have noticed, physically disconnecting RX1 from ULCD then reconnecting, will also work.
      Last edited by marty; 17th June 2017, 10:16 AM.

      Comment


      • #4
        <=43DT can be powered from MCU vin, less likely >=50DT

        never power from the mcu's onboard 5v LDO regulator, it wont have enough power to drive the lcd, and overheat if not function properly.

        the power may not be efficient on the power source, depending on your lcd (which i dont know which model you have) you should have 1A or higher at 5v for 5"+ screens, usb 500mA not always sufficient...

        the last few lines of your last post suggest a reset logic issue in your code, and the code is not in sync with the lcd, again, cant diagnose that yet till you post it
        Last edited by tonton81; 17th June 2017, 10:27 AM.

        Comment


        • #5
          Its not a power issue as said both my Rig and USB hub provide enough power for a 5v nano running several sensors and a ULCD-220 which has a min requirement of 50MV.

          Instead of posting pages of code, even the simplified version below has the same results - ULCD220 will not initiate any serial coms unless it is powered up After the Nano



          simple arduino Code
          Code:
                 int an0pin = 3;  
          int an1pin  =4;                  
          int an2pin = 5;        
          int vala = 0;
          int valb  = 0;
          int valc  = 0;
          int resa =0;
          int resb =0;
          int resc =0;
          void setup()
          {
          Serial.begin(57600);          //  setup serial
          }
          
          void loop()
          {
            vala = analogRead(an0Pin);  
          resa = map(val, 0, 1023, 0, 100)
          
          
          valb = analogRead(an1Pin);  
          resb = map(val, 0, 1023, 0, 100)
          
          
          valc = analogRead(an2Pin);  
          resc = map(val, 0, 1023, 0, 100)
          
          
          /send our data
          Serial.write (":") ; //Send start of buffer qualifier to ULCD220
          
          Serial.write (resa) ;
          Serial.write (resb) ;
          Serial.write (resc) ;
          
          delay (20);    
          }




          and simple code on the ULCD220...


          Code:
          #platform "uLCD-220RD"
          
          #inherit "4DGL_16bitColours.fnc"
          
          #inherit "VisualConst.inc"
          
          #inherit "boostedConst.inc"
          
          #inherit "LedDigitsDisplay.INC"
          
          var combuf[4];
          
          func main()
          
          
          com_SetBaud(COM1, 5760);
          
          COM1_RX_pin(PA2);
          
          COM1_TX_pin(PA3);
          
          com1_Init(combuf, 4, ':' ); // set up a coms buffer, requires ':' lead in character
          
          
          
          
           var hstrings ; // Handle to access uSD strings, uncomment if required
           var hFontx ;   // Handle to access uSD fonts, uncomment if required and change n to font number
          
          
              if (!(file_Mount()))
                  while(!(file_Mount()))
                      putstr("Drive not mounted...");
                      pause(200);
                      gfx_Cls();
                      pause(200);
                  wend
              endif
             gfx_TransparentColour(0xFFFF);  
             gfx_Transparency(ON);            
          
          
              hstrings := file_Open("boosted.txf", 'r') ; // Open handle to access uSD strings, uncomment if required
              hndl := file_LoadImageControl("boosted.dat", "boosted.gci", 1);
          
          
          
               var ch ;
               var ch1 ;
               var ch2 ;
               var ch3 ;
          
          
          
              repeat    //main program loop
          
          
              //read in serial data from arduino
                repeat until(com1_Full());
                ch := serin1(); //qualifier
                ch1 := serin1(); // ress
                ch2 :=serin1();   //resb
                ch3 :=serin1();   //resc
          
          
          ULCD220HANGS HERE UNLESS POWERED AFTER ARDUINO

          Comment


          • #6
            you never specified what lcd you had to begin with, and that is correct, the lcd should be powered up after the mcu, or if not, reset after the mcu boots via the reset line. you are also not verifying if there is data available before reading from the buffer... ? look at where you said it freezes, how do you read an empty buffer if the lcd boots up before the mcu writes to it??? and your writing to the display every 20ms, again, since theres partial code, if you start writing too fast before it completes processing the widget data, you may have additional problems...
            Last edited by tonton81; 18th June 2017, 08:20 AM.

            Comment

            Working...
            X