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

    UART bootloader + I2C LCD problem

    userc_39343

       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. Re: UART bootloader + I2C LCD problem
          rola_264706

          Sir You need a bootloader component and not Bootloadable component you also need a UART Component to do the bootloading. You also have not started your capsense component or set the CapSense_InitializeAllBaselines(); command I don't know how it worked at all.  I am sending you a program that has the bootloader in it so you can add your program into it. 

          • 2. Re: UART bootloader + I2C LCD problem
            userc_39343

            Thanks for your reply.

               

            I have the Bootloadable component linked to bootloader .hex and .elf files just like your example. They are in another folder so they were not included in the .zip, sorry. 

               

            What UART component should I use? I don't see one in your example?

               

            I removed the CapSense code to isolate the problem, just forgot to remove the component itself.

            • 3. Re: UART bootloader + I2C LCD problem
              rola_264706
                      There are two sections to the program I sent you. At the top is the led section and if you scroll down in the left panel of Psoc Creator you will see the code for the bootloader. If you look at the topdesign you will see the UART and the bootloader components.   
              • 4. Re: UART bootloader + I2C LCD problem
                userc_39343

                Thank you,

                   

                I copied my code into your project, same problem. I added the bootload project (with the bootload and UART component) to my workspace and linked the bootloadable components to the hex and elf files again. Still the same problem, what am I missing here?

                • 5. Re: UART bootloader + I2C LCD problem
                  rola_264706

                  Are you trying to program a board or are you trying to use the bootloader to program the board with a new program at a later time after you have installed the original program? Such as an ECO to the program. Also did you look at the bootloader section of the program I sent you it has some delays that are set by the bootloader to insure that the programmer works correctly.

                  • 6. Re: UART bootloader + I2C LCD problem
                    userc_39343

                    I'm trying to program a new program to the board using the bootloader and UART. What is an ECO?

                       

                    Your bootloader folder did not include the project files, only .hex and .elf

                    • 7. Re: UART bootloader + I2C LCD problem
                      rola_264706
                              A ECO is an engineering change . If you had a device in the field and you want to upgrade the program. I am still not clear as to what you want to do. The program with the LED blink does every thing you need to program the board.   
                      • 8. Re: UART bootloader + I2C LCD problem
                        JoMe_264151

                        Sorry, but isn't ECO the acronym for External Crystal Oscillator?

                           

                         

                           

                        Bob

                        • 9. Re: UART bootloader + I2C LCD problem
                          rola_264706

                          Bob not in the Military electronic field it stands for Engineering Change Order. I guess it could also stand for external crystal oscillator .   Lukasakerlund here are some PDF's that explain Bootloaders in PSOC 4. 

                          • 10. Re: UART bootloader + I2C LCD problem
                            olbrc_1547351

                            Sorry if this is off topic but as you're discussing a CY8CKIT-049 can you tell me where the example code is. I have PSoC creator and it has a long list of examples but I can't find the specific ones listed in the kit documentation (Bootloadable LED blink). It looked as if they were in a separate download but I can't find it.

                               

                            FWIW I don't have a programmer for the PSoC, I intend to use the bootloader that should be already programmed along with the demo.

                            • 11. Re: UART bootloader + I2C LCD problem
                              JoMe_264151

                              Welcome in the forum, Oliver!

                                 

                              When you did install the kit files there is an entry in Creator's start page for the Kits you have got. When you missed that step you may catch up with files from here. As an interesting alternative, there is a CY8CKIT-043 which not only has got a larger chip with more capabilities, but comes with a programmer and debugging capabilities that make experiencing PSoCs a bit (or byte) easier.

                                 

                               

                                 

                              Bob

                              • 12. Re: UART bootloader + I2C LCD problem
                                olbrc_1547351

                                Thanks, it looks as if the files were already installed because on running the installer it offers to remove them.

                                   

                                In hindsight I must have missed the part of the release notes telling me where to find them.

                                   

                                The CY8CKIT-043 looks interesting, at first I couldn't see the difference but I see that the USB part provides a SWD interface instead of just serial so it isn't dependent on a boot-loader in the target chip. I've already used a MBED module, that uses a similar concept except there's no provision for breaking off the programmer section on the MBED. The 043 model doesn't appear to have made it into the Farnell catalog yet.

                                   

                                I'm quite interested in the USB-Serial part of the 049 board.

                                • 13. Re: UART bootloader + I2C LCD problem
                                  JoMe_264151

                                  For the -49: Look at the schematics of your kit (Programs(x86)\Cypress\ your kit name\hardware\...

                                     

                                  There is an USB-UART bridge: connect an UART component to the pins P4_0 and P4_1, look for the com-port the USB device emulates (windows->system->device manager) and connect that port to PuTTY or whatever terminal program you use.

                                     

                                   

                                     

                                  Bob

                                  • 14. Re: UART bootloader + I2C LCD problem
                                    olbrc_1547351

                                    Thanks for the tip. Sending to the PC worked. I'm currently trying to rewrite a crude Modbus device I originally wrote for a MBED to run on it. The UART API is different enough to give me some problems, better in some ways but different. I appreciate having a non-blocking read function, it is an annoying omission in the API I used previously.

                                       

                                    Unfortunately the program as written needs a software delay of 500us. I probably need to rewrite it to use hardware timing eventually but for now I could use a delay, but there doesn't seem to be a "delay" or "wait" defined.

                                    1 2 Previous Next