Problem on STM32L1 with USART and I2C
Posted: Sun Nov 10, 2013 2:58 pm
Hi,
I'm toying around with a STM32L1 discovery using ChibiOS 2.6.1. I currently have taken the UART example from testhal/STM32L1xx/ and have added I2C to it so that I can communicate with a I2C to 1wire chip that is wired up to my uC.
Everything was working fine while I used UART2 (TX/RX on pins PA2/3 respectively) and I2C2 (SCL SDA on pins PB10/PB11 respectively). Now I am laying out a board and geographically it makes more sense for me to use I2C1 on pins PB6/7. When I switch the I2C config and pins, neither the UART nor the I2C seems to work. I scoped the I2C bus and can see the signals twiddle as it sends the device ID but my I2C to 1wire chip never responds. Likewise, I don't seem to receive any charactersr on the UART2. If I simply comment out the UART related code, the I2C1 communicates as expected.
Next, if I switch to using USART1 (TX/RX on pins PA9/10) the USART1 and I2C1 both seems to work.
I checked the datasheet/manuals for the STM32L15x and can't see any reasons for this (although I am quite new to these devices). Can anyone offer any help in troubleshooting this?
So to summarize:
Works:
I2C2 on PB10/11 with USART2 on PA2/3
I2C1 on PB8/9 with USART1 on PA9/10
Not working:
I2C1 on PB8/9 with USART2 on PA2/3 (commenting out the USART makes I2C work again)
Thanks,
Dave
I'm toying around with a STM32L1 discovery using ChibiOS 2.6.1. I currently have taken the UART example from testhal/STM32L1xx/ and have added I2C to it so that I can communicate with a I2C to 1wire chip that is wired up to my uC.
Everything was working fine while I used UART2 (TX/RX on pins PA2/3 respectively) and I2C2 (SCL SDA on pins PB10/PB11 respectively). Now I am laying out a board and geographically it makes more sense for me to use I2C1 on pins PB6/7. When I switch the I2C config and pins, neither the UART nor the I2C seems to work. I scoped the I2C bus and can see the signals twiddle as it sends the device ID but my I2C to 1wire chip never responds. Likewise, I don't seem to receive any charactersr on the UART2. If I simply comment out the UART related code, the I2C1 communicates as expected.
Next, if I switch to using USART1 (TX/RX on pins PA9/10) the USART1 and I2C1 both seems to work.
I checked the datasheet/manuals for the STM32L15x and can't see any reasons for this (although I am quite new to these devices). Can anyone offer any help in troubleshooting this?
So to summarize:
Works:
I2C2 on PB10/11 with USART2 on PA2/3
I2C1 on PB8/9 with USART1 on PA9/10
Not working:
I2C1 on PB8/9 with USART2 on PA2/3 (commenting out the USART makes I2C work again)
Thanks,
Dave