There is a case when two pairs PB6/PB7 and PB8/PB9 are used with different I2C slaves on I2C1. Is it possible change only AFIO->MAPR without i2cStart/i2cStop or restart it required?
Chibios 20.3
STM32F103 I2C change mapping on fly
Moderators: RoccoMarco, barthess
- Giovanni
- Site Admin
- Posts: 14455
- Joined: Wed May 27, 2009 8:48 am
- Location: Salerno, Italy
- Has thanked: 1076 times
- Been thanked: 922 times
- Contact:
Re: STM32F103 I2C change mapping on fly
Hi,
It is not safe in my opinion, you could have glitches pm SDA/SCL depending on how GPIO is designed. Make sure to not do that while I2C is active anyway.
Giovanni
It is not safe in my opinion, you could have glitches pm SDA/SCL depending on how GPIO is designed. Make sure to not do that while I2C is active anyway.
Giovanni
-
- Posts: 25
- Joined: Fri Nov 06, 2020 3:28 pm
- Location: Salivonky UA
- Has thanked: 4 times
- Been thanked: 4 times
Re: STM32F103 I2C change mapping on fly
Giovanni wrote:Hi,
It is not safe in my opinion, you could have glitches pm SDA/SCL depending on how GPIO is designed. Make sure to not do that while I2C is active anyway.
Giovanni
Read/Write operations are protected. So so switching mode is not performed during activity. It is just question of software.
Re: STM32F103 I2C change mapping on fly
I would think that the IO pad design on the chip is synchronous. So if you change from AFx to GPIO on the fly, at one point the I2C module is providing the data driving the pin and the next clock it will revert back to the ODR. This is just like changing another pin in the same ODR: Glitches would be bad.
I think it is safe and can be done. Won't hurt to check for yourself though. The critical moment is when you switch from GPIO to I2C and back. So you can just do that switch a million times a second without sending any I2C data, so you can see if the scope triggers on anything, and test it a 100 million times in under two minutes....
I think it is safe and can be done. Won't hurt to check for yourself though. The critical moment is when you switch from GPIO to I2C and back. So you can just do that switch a million times a second without sending any I2C data, so you can see if the scope triggers on anything, and test it a 100 million times in under two minutes....
Who is online
Users browsing this forum: No registered users and 15 guests