I2C Bootloader with flexible I2C Slave Adress

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

cross mob
pacr_284376
Level 5
Level 5
100 replies posted 10 solutions authored 50 sign-ins

 Hi,

   

I am using the I2C bootloader which works great. 

   

Until now I did setup the slave adress (0x08) in the I2C component settings because I always used the same adress

   

But now I want to setup the I2C Bootloader Slave adress from code (in this example 0x09) to be able to use a slave adress which depends of e.g. a dipswitch setting.

   

I did the following in the main.c but the I2C adress stays the adress given in the component settings :

   

#include <project.h>

   

int main()

   

{

   

    I2C_Init();

   

    I2C_SlaveSetAddress(0x09);

   

    CyGlobalIntEnable;

   

    Bootloader_Start(); /* Does not return */

   

    for(;;){};

   

}

   

Probably the Bootloader_Start re-initializes I2C using the component's I2C adress. Is there any way to do what I want ? 

   

Thanks

   

Patrick

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

Your assumptions are right, Patrick. The BooLoader_Start() re-initializes the interface.

   

Workaround:

   

Define Custom interface for Bootloader and provide your own functions, ie. reading your dip-switch at initialization.

   

Its a bit of work, but you can peep into the original sources.

   

 

   

Bob

0 Likes