UART bootloader + I2C LCD problem

Tip / Sign in to post questions, reply, level up, and achieve exciting badges. Know more

cross mob
lock attach
Attachments are accessible only for community members.
Anonymous
Not applicable

 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();
        }                            
    }
}

   
0 Likes
19 Replies
lock attach
Attachments are accessible only for community members.
rola_264706
Level 8
Level 8
50 likes received 25 likes received 10 likes received

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. 

0 Likes
Anonymous
Not applicable

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.

0 Likes
rola_264706
Level 8
Level 8
50 likes received 25 likes received 10 likes received
        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.   
0 Likes
Anonymous
Not applicable

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?

0 Likes
rola_264706
Level 8
Level 8
50 likes received 25 likes received 10 likes received

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.

0 Likes
Anonymous
Not applicable

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

0 Likes
rola_264706
Level 8
Level 8
50 likes received 25 likes received 10 likes received
        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.   
0 Likes
Bob_Marlowe
Level 10
Level 10
First like given 50 questions asked 10 questions asked

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

   

 

   

Bob

0 Likes
lock attach
Attachments are accessible only for community members.
rola_264706
Level 8
Level 8
50 likes received 25 likes received 10 likes received

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. 

0 Likes
Anonymous
Not applicable

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.

0 Likes
Bob_Marlowe
Level 10
Level 10
First like given 50 questions asked 10 questions asked

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

0 Likes
Anonymous
Not applicable

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.

0 Likes
Bob_Marlowe
Level 10
Level 10
First like given 50 questions asked 10 questions asked

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

0 Likes
Anonymous
Not applicable

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.

0 Likes
Bob_Marlowe
Level 10
Level 10
First like given 50 questions asked 10 questions asked

In the "System Reference Guide" to be found from Creator's Help-menu there are two delay functions defined:

   

CyDelay() for ms

   

CyDelayus() for µs

   

 

   

Bob

0 Likes
Anonymous
Not applicable

Thanks again, I don't think I'd have found that without help as even with the guide open I still had to do a search for "delay" to locate CyDelay in the TOC.

   

Got there now.

0 Likes
Bob_Marlowe
Level 10
Level 10
First like given 50 questions asked 10 questions asked

There is a "Cypress Document Manager" installed on your system (Start -> Cypress ...). I'd suggest you to give it a try, sometimes easier than to wait for a response (although this was a rather fast one).

   

 

   

Bob

0 Likes
Anonymous
Not applicable

I don't think its installed right now so I'll go look for it, I think I have seen it mentioned so maybe it was only an optional part of the package. I selected "Typical" I think when installing. Also I notice that there's other stuff installed under the "Program Files(86)\Cypress" path that isn't referenced in shortcuts. That's why I failed to find the 049 kit's files originally.

   

I am finding the documentation hard work. Maybe that's inevitable due to the complexity of the devices though.

0 Likes
Bob_Marlowe
Level 10
Level 10
First like given 50 questions asked 10 questions asked

Oliver, your name sounds English, so when I understand (most) of the documentation as a non-native English speaking you should be easier off than me. I appreciate the documentation and the fact that the component's datasheet usually are only some mouse clicks away. Cypress always reacts when hinted to some unclearness or ambiguities in the docs and corrects them asap.

   

 

   

Bob

   

Now afk preparing dinner 😉

0 Likes