- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi, there
I'm working on USB serial i2c example based on cy7c65215 USB to serial bridge.
I find that if change the variable CY_I2C_CONFIG and CY_I2C_DATA_CONFIG to a static variable, the waveform output from cy7c65215 goes to an unexpected waveform, quite different from what I set
the picture up there is the right waveform that I expect the slave address is 0x69 when I did not add the 'static' before the variable definition.
but if I add the 'static ' keyword before the variable definition, the waveform goes bad, like the picture below
Does anyone know what goes on after I add the static keyword?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi,
Can you please let me know the reason for declaring this as static? Static variables are mostly used for preserving their value even out of their scope.
Also, please share the second waveform. I see that both waveforms are the same.
Regards,
Meghavi
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
hi,
I've changed the message to a right waveform in the 2nd picture.
the reason for the static is for a test .
At first, I changed these 2 variables to global variables, because I want to cut the huge I2CMaster to some small parts, like I2C_Init and I2C_readreg .....
because these configure do not need to be changed during these functions, I changed them to global variables for convenience, but after that, the waveform becomes abnormal in the third picture.
In that picture, the address is not the 0x69 that I set in my code. the address shown on that is 0x6D.
for global variable are stored in static memory area after compile. I guess the cause phenominon is because of the variable area in memory , So , I did a test , to add static keyword to variables.
then the static variable works bad , like global variable did.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi,
Can you kindly set the slave address as 0x45 and let us know the result?
Regards,
Meghavi