1 2 Previous Next 19 Replies Latest reply on Dec 26, 2015 8:39 AM by user_1377889

    UART bootloader + I2C LCD problem

    lukasakerlund_1537441

       I'm having a weird problem. I'm driving a LCD05 with I2C, and I use a button to return to the bootloader. I'm using a CY8CKIT-049-42xx.

         

      The code below works fine, however if I remove the 1s delay in the for loop, or set it to something lower, say 100ms, the bootloader does not work properly when activated. The led flashes and I get the "Bootloader ready" on the display, but the bootloader host says:

         

      - Communication port reported error 'Unable to read data from the target device'.

         

      And times out after 5s, then I have to physically reconnect the usb-connector to get the following error:

         

      - The bootloader reported error 'Unknown error 0x98 occurred in the bootload process'.

         

      Pressing the program button again after that programs the processor. Any ideas?

         

      I'm running PSoC creator 3.3 in win7 in WMware on a mac book pro.

         


      The display: http://www.robot-electronics.co.uk/htm/Lcd05tech.htm

         

       

         

      #include <project.h>

         
          

      #define LCD_MODULE_ADDRESS     (0xC6u)

          

      uint8 blFlag = 0;

          

      CY_ISR_PROTO(enterBootloader);

          

      CY_ISR(enterBootloader)
      {   
          blFlag = 1;
      }

          

      int main()
      {
          CyGlobalIntEnable;
          
          BL_ISR_StartEx(enterBootloader);
          
          I2C_Start();
          I2C_LCD_Start();
          I2C_LCD_HandleOneByteCommand(0x1f, 0xff); //Set brightness to 0xff
          CyDelay(1000u);
          
          uint8 i = 0;
          
          for(;;)
          {
              I2C_LCD_ClearDisplay();
              I2C_LCD_PrintInt8(i);
              i++;
              
              CyDelay(1000u);
              
              if( blFlag == 1)
              {
                  I2C_LCD_ClearDisplay();
                  I2C_LCD_PrintString("Bootloader ready");            
                  Bootloadable_Load();
              }                            
          }
      }

         
        1 2 Previous Next