compiler runs on it's own!

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 trying to make use of I2CHW module, i order to modify comparator hyst parameter.
For testing only I put control value in I2cregs.cSTR[4] to see what is going on.
I figured out that code puts the value which is not entered.

   

I mean that under I2CRegs.cStr[4] appears value 0x70 after I2Cconversation

   

w 04+ 00+ 10+ 10+ 10+ 10+ 10+ p
r 04+ 00+ 70+ 00+ 00+ 10+ 10+ 00+ p
w 04+ 01+ 10+ 10+ 10+ 10+ 10+ p
r 04+ 10+ 70+ 00+ 00+ 10+ 70+ 00+ p

   

Please ommit  00 twice after 70. it's from the rest of the code

   


Below is the code which runs in the loop:
"
volatile unsigned char histCurrent = 0x70;
void I2C(void)
{
BYTE status;
status = I2CHW_bReadI2CStatus();
        /* Wait to read data from the master */
        if( status & I2CHW_WR_COMPLETE ){
         /* Data received - clear the Write status */
            I2CHW_ClrWrStatus();
            /* Reset the pointer for the next read data */
            I2CHW_InitWrite((BYTE*)&I2CRegs,BS);

            if(I2CRegs.bCmd == 0x01)
            {
             switch (I2CRegs.cStr[0])
             {
             case COMP_REF0_937:
             case COMP_REF0_875:
             case COMP_REF0_812:
             case COMP_REF0_750:
             case COMP_REF0_688:
             case COMP_REF0_625:
             case COMP_REF0_562:
             case COMP_REF0_500:
             case COMP_REF0_437:
             case COMP_REF0_375:
             case COMP_REF0_312:
             case COMP_REF0_250:
             case COMP_REF0_188:
             case COMP_REF0_125:
             case COMP_REF0_062:
             case COMP_REF0_042:
             case COMP_REF0_021:
             histCurrent = I2CRegs.cStr[0] ;
             I2CRegs.cStr[4] = I2CRegs.cStr[0];
             break;
             default:
             histCurrent = COMP_REF0_500;
             I2CRegs.cStr[4] = I2CRegs.cStr[0];
             break;
             }
               
            COMP_SetHyst(histCurrent);
            I2CRegs.bCmd = 0x10;
            }else I2CRegs.bCmd = 0;
       
        }
        if( status & I2CHW_RD_COMPLETE )
        {
                    /* Data echoed - clear the read status */
            I2CHW_ClrRdStatus();
            /* Reset the pointer for the next data to echo */
            I2CHW_InitRamRead((BYTE*)&I2CRegs,BS);
        }
}"
 

0 Likes
1 Reply
Anonymous
Not applicable

Another conversation example. Look's as if number after address determines number of nines from the end of buffer.
But the code do not contain 9, nor it's logic is not such.

   

Secondly please note that if conversation starts with address plus 01 then next byte is acknowledged. If not next byte is not acknowledged. The code is not able to do this, unless You interfere with interrupts which I don't use at all

   


I have no doubt now that newly purchased CY8C24223A chip is broken.

   

Simply no way to comunicate with device. Maybe artificial inteligence is sitting inside chip and send conversation invitations which I  hardly undersand. Thanks CYPRESS TEAM

   


follow up conversation:
w 04+ 01+ 05+ p
r 04+ 05+ 00+ 00+ 01+ 00+ 00+ 00+ 00+ 00+ 09+ p
w 04+ 01+ 08+ p
r 04+ 08+ 00+ 00+ 01+ 00+ 00+ 00+ 00+ 00+ 09+ p
w 04+ 02+ 08- p
r 04+ 00+ 00+ 01+ 00+ 00+ 00+ 00+ 00+ 09+ 09+ p
w 04+ 02+ 08- p
r 04+ 00+ 00+ 01+ 00+ 00+ 00+ 00+ 00+ 09+ 09+ p
w 04+ 03+ 08- p
r 04+ 00+ 01+ 00+ 00+ 00+ 00+ 00+ 09+ 09+ 09+ p
w 04+ 04+ 08- p
r 04+ 01+ 00+ 00+ 00+ 00+ 00+ 09+ 09+ 09+ 09+ p
w 04+ 03+ 08- p
r 04+ 00+ 01+ 00+ 00+ 00+ 00+ 00+ 09+ 09+ 09+ p

   

 

   

 

   

 

   

 

   

 

   

http://www.psocdeveloper.com/forums/viewtopic.php?f=3&t=7032

0 Likes