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

cross mob
AnFa_301266
Level 3
Level 3
5 questions asked First question asked 25 replies posted

I'm trying to find the original sample projects for the bootloaders that used to be with the AN68272 application note but, maybe since Infineon took lover, this seems to have been taken down.  Specifically looking for the UART Bootloader code for C# ideally or C if not.

I have found an executable version which works OK (Thanks PlusPlus!) but would like to integrate the functionality of the UART bootloader  into our application.

Any ideas?

Thanks

0 Likes
1 Solution
KyTr_1955226
Level 6
Level 6
250 sign-ins 10 likes given 50 solutions authored

I actually have the old AN68272 Bootloader Host GUI project kicking around.  I've attached it.

I will note though that I ran into a number of problems, especially with the interop services to allow the C unmanaged bootl_utils.dll to work with a C# .NET application.  At the very least though it can maybe provide a starting point like it did for me to build you own application.

I can also share the library I built to port the bootloader host dll (originally written in C) into C# .NET so that I could use it as a managed library with my host application rather than having to use interop where I was running into so many issues.  I can't promise it's perfect, I'm sure there's still bugs present I haven't come across, but it may make getting a bootloader host application going quicker.  The linked thread has download links for the project I used during development, which includes a WPF testing application that uses the UART.

You say you already have a USB bootloader going, so changing around to a different communcation interface such as UART shouldn't be much trouble at all if you're using the bootl_utils.dll.  Just a matter of writing the requisite OpenConnection()/CloseConnection()/ReadData()/WriteData() functions to use your desired communication interface.

In the C# version of the bootl_utils library, I wrote it so the communication functions are written as an interface that you pass to the CyBtldr_Program() API function:

 

public class UART_ConnectionData : ICommunicationData
{
    public HostReturnCodes OpenConnection()
    {
        HostReturnCodes status = HostReturnCodes.CYRET_SUCCESS;
        //Open the COM Port

        return status;
    }

    public HostReturnCodes CloseConnection()
    {
        HostReturnCodes status = HostReturnCodes.CYRET_SUCCESS;
        //Close the COM Port

        return HostReturnCodes.CYRET_SUCCESS;
    }

    public HostReturnCodes ReadData(byte[] dataBuf, uint numBytes)
    {
        HostReturnCodes status = HostReturnCodes.CYRET_SUCCESS;
		//Read numBytes amount of data from COM Port into dataBuf
        return status;
    }

    public HostReturnCodes WriteData(byte[] dataBuf, uint numBytes)
    {
        HostReturnCodes status = HostReturnCodes.CYRET_SUCCESS;
        //Write numBytes amount of data to COM Port from dataBuf
        return status;
    }

    public int MaxTransferSize
    {
        get { return 64; }		//Default 64 Bytes per packet
    }

}

 

 

Create an instance of the interface object:

 

UART_ConnectionData UART_CommData = new UART_ConnectionData();

 

 

And then just pass it to the CyBtldr_Program() API function:

 

BootloaderAPI.CyBtldr_Program(Chosen_File_Cyacd, securityKey, appID, UART_CommData, update);

 

View solution in original post

5 Replies
BiBi_1928986
Level 7
Level 7
First comment on blog 500 replies posted 250 replies posted

Hello.

You can follow this thread explaining what happened to code previously attached to AN68272.
Solved: AN68272: C# Project UART Bootloader Host GUI is go... - Infineon Developer Community

And, the code for AN73503 should be in one of these zip files.
Infineon Technologies

I haven't checked it out.
Let us know if you find what you're looking for.

In the meantime, I've attached older AN68272 zip.

AnFa_301266
Level 3
Level 3
5 questions asked First question asked 25 replies posted

Hi,

Many thanks for the reply and links.

Looks like all of the files referenced are more for the bootloader hosted in the PSoC whereas I was really looking for the PC based host using the UART/RS232 either for or like the one bundled with PSoC Creator.

Thanks to your help a while ago, we have the PSoC end of the bootloader/bootloading up[ and running but now looking to integrate the PC based bootloader into our C# GUI application for our users.  I was expecting to just be able to download the source for the Cypress Bootloader Host which has support for all the options (UART, USB, etc) and use that as a template.

We have implemented a USB only PC Bootloader Host so have the source for this so maybe the way forward is to try and convert this to use the UART/RS232 instead.  Not sure how straightforward that will be but it maybe simpler than I am thinking.  We are a very small team so constantly wrestling with priorities and never enough time but we really need to implement this.

Anyway, if you happen to have access to source code for a PC based C# Bootloader that will support UART transfer that would be a great starting point for us.

Thanks again for your help in the past and look forward to hearing from you:-)

0 Likes
KyTr_1955226
Level 6
Level 6
250 sign-ins 10 likes given 50 solutions authored

I actually have the old AN68272 Bootloader Host GUI project kicking around.  I've attached it.

I will note though that I ran into a number of problems, especially with the interop services to allow the C unmanaged bootl_utils.dll to work with a C# .NET application.  At the very least though it can maybe provide a starting point like it did for me to build you own application.

I can also share the library I built to port the bootloader host dll (originally written in C) into C# .NET so that I could use it as a managed library with my host application rather than having to use interop where I was running into so many issues.  I can't promise it's perfect, I'm sure there's still bugs present I haven't come across, but it may make getting a bootloader host application going quicker.  The linked thread has download links for the project I used during development, which includes a WPF testing application that uses the UART.

You say you already have a USB bootloader going, so changing around to a different communcation interface such as UART shouldn't be much trouble at all if you're using the bootl_utils.dll.  Just a matter of writing the requisite OpenConnection()/CloseConnection()/ReadData()/WriteData() functions to use your desired communication interface.

In the C# version of the bootl_utils library, I wrote it so the communication functions are written as an interface that you pass to the CyBtldr_Program() API function:

 

public class UART_ConnectionData : ICommunicationData
{
    public HostReturnCodes OpenConnection()
    {
        HostReturnCodes status = HostReturnCodes.CYRET_SUCCESS;
        //Open the COM Port

        return status;
    }

    public HostReturnCodes CloseConnection()
    {
        HostReturnCodes status = HostReturnCodes.CYRET_SUCCESS;
        //Close the COM Port

        return HostReturnCodes.CYRET_SUCCESS;
    }

    public HostReturnCodes ReadData(byte[] dataBuf, uint numBytes)
    {
        HostReturnCodes status = HostReturnCodes.CYRET_SUCCESS;
		//Read numBytes amount of data from COM Port into dataBuf
        return status;
    }

    public HostReturnCodes WriteData(byte[] dataBuf, uint numBytes)
    {
        HostReturnCodes status = HostReturnCodes.CYRET_SUCCESS;
        //Write numBytes amount of data to COM Port from dataBuf
        return status;
    }

    public int MaxTransferSize
    {
        get { return 64; }		//Default 64 Bytes per packet
    }

}

 

 

Create an instance of the interface object:

 

UART_ConnectionData UART_CommData = new UART_ConnectionData();

 

 

And then just pass it to the CyBtldr_Program() API function:

 

BootloaderAPI.CyBtldr_Program(Chosen_File_Cyacd, securityKey, appID, UART_CommData, update);

 

Hi,

Many thanks for this information.  I haven't had a chance to look through in detail but it looks like it will be really useful.  I'll take a look over the weekend and see if we can get something working.

I'll let you know how we get on.

All the best

0 Likes
Aashita_R
Moderator
Moderator
Moderator
50 likes received 100 solutions authored 250 replies posted

Hi @AnFa_301266 ,

The thread was locked due to inactivity for a long time. You can continue the discussion on the topic by opening a new thread with reference to the locked one. The continuous discussion in an inactive thread may mostly be unattended by community users.

Best Regards,

Aashita

0 Likes