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
Problem on STM32L1 with USART and I2C
Moderator: RoccoMarco
- Giovanni
- Site Admin
- Posts: 14892
- Joined: Wed May 27, 2009 8:48 am
- Has thanked: 1202 times
- Been thanked: 996 times
Re: Problem on STM32L1 with USART and I2C
Hi,
Check for DMA conflicts on the reference manual.
Giovanni
Check for DMA conflicts on the reference manual.
Giovanni
Re: Problem on STM32L1 with USART and I2C
Giovanni,
Of course you are right! UART1 and I2C2 share DMA channels, as do UART2 and I2C1. In case this helps anyone else (or future me, searching the forum), reference Table 41 "Summary of DMA1 requests for each channel" in RM0038.
Thanks!
Of course you are right! UART1 and I2C2 share DMA channels, as do UART2 and I2C1. In case this helps anyone else (or future me, searching the forum), reference Table 41 "Summary of DMA1 requests for each channel" in RM0038.
Thanks!
- Giovanni
- Site Admin
- Posts: 14892
- Joined: Wed May 27, 2009 8:48 am
- Has thanked: 1202 times
- Been thanked: 996 times