Dynamically Switch CSD Bleed Resistor between P1[1] and P1[4]

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

cross mob
Anonymous
Not applicable

 Hi,

   

 

   

I'm using the CY8C21534 and need to switch bleed resistor between P1[1] and P1[4]. I followed the application note CE66058 and came to the routines:

   

void Connect_Rb_to_P1_4(void)

   

{

   

/*Disconnect P1[1] from Global Out buses*/

   

PRT1GS &= ~0x02;

   

/*Change the drive mode to High Z Analog*/

   

PRT1DM0 &= ~0x02;

   

/*Disable the comparator connection to GOO1*/

   

CMP_GO_EN &= ~0x40;

   

/* Change Analog LUT Control Register 0 */

   

ALT_CR0 &= ~0xc5;

   

ALT_CR0 |= 0x0c;

   

/*Enable the comparator connection to GOO4*/

   

CMP_GO_EN |= 0x08;

   

/*Change the drive mode of the pin to open drain low*/

   

PRT1DM0 |= 0x10;

   

/*Connect P1[4] to Global out bus*/

   

PRT1GS |= 0x10;

   

}

   

void Connect_Rb_to_P1_1(void)

   

{

   

/* Disconnect P1[4] from Global Out buses */

   

PRT1GS &= ~0x10;

   

/* Change the drive mode to High Z Analog */

   

PRT1DM0 &= ~0x10;

   

   

/* Disable the comparator connection to GOO4 */

   

CMP_GO_EN &= ~0x08;

   

/* Change Analog LUT Control Register 0 */

   

ALT_CR0 &= ~0x0c;

   

ALT_CR0 |= 0xc5;

   

/* Enable the comparator connection to GOO1 */

   

CMP_GO_EN |= 0x40;

   

/* Change the drive mode of the pin to open drain low */

   

PRT1DM0 |= 0x02;

   

/* Connect P1[1] to Global out bus */

   

PRT1GS |= 0x02;

   

}

   

 

   

But it doesn't seem to work. Can it be that I need to change some other registers also?

   

 

   

Thanks.

0 Likes
3 Replies
ETRO_SSN583
Level 9
Level 9
250 likes received 100 sign-ins 5 likes given
0 Likes
Anonymous
Not applicable

The mask values for the pins are

   

 P1_1      0x02

   

P1_4      0x10

   

 Does not seem like you are addressing the right pins

   

 

   

Regards, Dana.

   

 

   

But these are exacty the masks I use . I got these from the project datasheet. Should I change another register also?

   

 

   

Thanks

0 Likes
ETRO_SSN583
Level 9
Level 9
250 likes received 100 sign-ins 5 likes given

Your masks are correct, thats why I erased my post as I realized I was

   

in error.

   

 

   

Regards, Dana.

0 Likes