I am trying to make I2C as a SMBUS Master . I am facing following issues
1. Removal insert of SMBUS slaves make s I2C interfaces to get stuck .- Reason - In ISR I2C master is waiiting for configured number of Slave replies .
2. To avoid above issue , we tried Manual mode of I2C interfaces , But now the problem is getting stuck in thye while loop inside API .
1. Is there any SMBUS master Blocks in PSOC ? I am only seeing SMBUS slave block .. Why ?
2. How to add a timeout to PSOC generated APIs?? . I feel I2C API without a timeout is Dangerours ,
Welcome in the forum!
I would suggest you to create a support case to get an answer from a Cypress engineer. To do so, at top of this page click on "Design Support -> Create a Support Case" and enter your query.
Would be nice, when you keep us informed here in the forum.
There was a recognized problem with clock stretching where the
APIs would block and not escape, no timeout mechanism. Example
disconnected pullups. It was recognized as an issue, even though
standard does not require it (oddly enough).
As Bob suggested file a CASE and see what the status of the fix is.
And I would ask you post back results you get for the benefit of the
Hi - I'm interested in the result of the CASE. Has this been opened?
Here is a prior thread on this topic, can be used when filing CASE -
Note is was for PSOC 1 but as I recall team thought problem was in 3/5LP also.
Makes one wonder if an ISR could be invoked off a timer when starting
an I2C transaction, and if ISR goes off because it times out on fault, it examines
stack to see if I2C hung in known routine, and clears the stack and generates some
recovery routine.....just a thought.
This of course could be a serious safety liability issue in some designs, so needs to be
If I had my druthers, I would prefer to fix the problem, in my case, by modifying the i2c_MasterWriteByte() in the auto generated file. That would be a lot easier than trying to figure out how to return to my calling routine after a timer timeout, since the issue occurs due to the PSOC driver sitting in an unending loop.
Is there a mechanism for the user to modify one of the autogenerated files that is not intended for user additions?
Not in the auto generated files unless Cypress has the placeholders, however -
From the component author guide in Craetor Help Docs -
Customizing components refers to the mechanism of allowing custom code (C#) to augment or
replace the default behavior of an instantiated component within PSoC Creator. The code is
sometimes referred to as “customizers,” which may:
customize the Configure dialog
customize symbol shapes / display based on parameter values
customize symbol terminal names, counts, or configuration based on parameters
generate custom Verilog code
generate custom C/assembly code
interact with the clocking system (for clock and PWM components)
I have opened a sapport case [ MyCase 2991585368 ] . I am new to this forum , so I dont know whether all people can view this case . If some other information is required to view this case please let me know .
As a solution I have Modified the Psoc API s that automatically created . NOw I am able to provide a Plug and play feature in I2C . problem is like next time when we build the design the entire code modification will be reverted . Solution for that was to maintain the driver in a separate file , But this project is going to be a long term one . So in between if we are changing Psoc chip , Some registers got changed means again their will be a rework in driver level . So tats wat I am worried about .
It was good if Cypress Can give a SMBus Master block also , Already Slave blocks are there and I2C master is not fully compatible with SMBUS .
Regarding CASE, that's private to you and Cypress. So when you get answer
post back results you get from tech support to support the forum.
You may create your own component out of the modified sources. Not easy but doable. There is a "Component Author Guide" in your Creator installation that handle that theme.
Resolution Given By Cypress
Please note SMBus master are usually implemented with I2C Master .Hence there is no plan currently to implement a SMBus Master.
*You can implement a timeout by adding a simple Glue Logic for monitoring lines and raising a timeout signal.
*As you have implemented modify the component to achieve timeout feature.So it is true that the code written will be lost when clean and build is issued if the modification is done on the generated files in the project.So You will need to customize a component and modify or add your code to the custom component and use this component instead in the project.The changes will now remain.Also try to use the names provided by fitter.h in case of accessing any registers.
You can import a existing component in Components tab of Creator and modify it .Now the project would use the modified instance of the component.
But if you want to have this consistency accross projects and creator workspace, you have to create a library add your modified component to it and enable dependency of your project on this library .You can create a Library project by File-->NewProject-->Other-->PSoC Library
Thanks for posting back, very helpful on a knotty problem.
Could you share your SMBus Master component here?
This would really help me and also some other people I guess.
Thanks a lot!