hi,
I am using MKM34Z256VLL7 .In which IIC using bit banging for giving SDA and SCL high-low i am using PDOR register directly to set that GPIO bit . Problem is total port F is getting disturbed other port pins are getting toggle in setting SDA , SCL with PDOR register if i am setting and clearing with PSOR and PCOR respectively than this problem is not coming .
So, anyone can tell me the difference between direct use of PDOR and by PSOR .
Thank you.
Darshan
Hi,
From the GPIOx_PSOR register description, write 0 doesn't affect other bit status:
While, the GPIOx_PDOR register, write 0 will affect other bit status:
So, For example: if want to set PTF5 (I2C1_SCL), it need to use:
GPIOF_PDOR |= (0x1 << 5) ;
If want to clear PTF5 (I2C1_SCL), it need to use:
GPIOF_PDOR &=~(0x1 << 5);
Wish it helps.
Have a great day,
Ma Hui
-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------
Or you can use the BME macros on GPIOF_PDOR to avoid the inefficient &= and |= ops for single bits in peripheral-address space.
And why that and,or ops giving such type of behavior.?
Sorry, I am not directly familiar with the byte-wide GPIO scheme in the KM series. I agree, there is no 'obvious' reason that |= 'ones' and &= 'not ones' should fail, although I couldn't find a direct description as to whether reading GPIOF_PDOR would always return the exact contents of the output holding register, OR the pin state.
BME macro only useful , &= and |= ops giving undesired output.