I discovered a difference in code generation for processorexpert SynchroMaster (SPI) component when I use 2 cpu clock configurations.
It's in function SendChar.
One cpu clock configuration OK:
byte SPIFLASH_SendChar(SPIFLASH_TComData Chr)
{
SPIFLASH_TComData TmpChr = OutBuffer; /* Save OutBuffer value */
if ((SerFlag & FULL_TX) != 0U) { /* Is last character send? */
return ERR_TXFULL; /* If no then return error */
}
if (EnUser) { /* Is device enabled? */
SMasterLdd1_Main(SMasterLdd1_DeviceDataPtr);
OutBuffer = Chr; /* Save character */
if (SMasterLdd1_SendBlock(SMasterLdd1_DeviceDataPtr, (LDD_TData *)&OutBuffer, 1U) == ERR_BUSY) { /* Send one data byte */
OutBuffer = TmpChr; /* If is device busy, restore OutBuffer value */
return ERR_TXFULL;
}
SMasterLdd1_Main(SMasterLdd1_DeviceDataPtr);
} else {
OutBuffer = Chr; /* Save character */
SerFlag |= FULL_TX; /* ...and set flag */
}
return ERR_OK;
}
Two cpu clock configurations ERROR
byte SPIFLASH_SendChar(SPIFLASH_TComData Chr)
{
if (!EnMode) { /* Is the device disabled in the actual speed CPU mode? */
return ERR_SPEED; /* If yes then error */
}
SPIFLASH_TComData TmpChr = OutBuffer; /* Save OutBuffer value */
SMasterLdd1_Main(SMasterLdd1_DeviceDataPtr);
OutBuffer = Chr; /* Save character */
if (SMasterLdd1_SendBlock(SMasterLdd1_DeviceDataPtr, (LDD_TData *)&OutBuffer, 1U) == ERR_BUSY) { /* Send one data byte */
OutBuffer = TmpChr; /* If is device busy, restore OutBuffer value */
return ERR_TXFULL;
}
SerFlag &= (byte)~(TX_BUF_EMPTY); /* Clear TX_BUF_EMPTY flag */
SMasterLdd1_Main(SMasterLdd1_DeviceDataPtr);
return ERR_OK;
}
I have tested this with few test projects and different toolchains in CW 10.4.
Any suggestions what should I try to get this solved?
thnx,b