Page 1 of 1

adcStart breaks i2c on stm32l432 ?

Posted: Tue May 30, 2017 11:50 pm
by geoffrey.brown
I have an application on an stm32l432 which uses both i2c and adc. i2c works fine except if I execute

adcStart(&ADCD1, NULL)

the adc works fine once I start it, but if the adc is started, the i2c i2cMasterTransmitTimeout(..) command returns an error code -- even if the only adc command executed is the adcStart command. Something in the initialization code is stepping on the i2c, but I haven't got a clue where to look.



Kernel: 4.0.0
Compiler: GCC 5.4.1 20160609 (release) [ARM/embedded-5-branch revision 237715]
Architecture: ARMv7E-M
Core Variant: Cortex-M4
Port Info: Advanced kernel mode
Platform: STM32L4xx Ultra Low Power
Board: STMicroelectronics STM32 Nucleo32-L432KC
Build time: May 30 2017 - 18:45:04

Re: adcStart breaks i2c on stm32l432 ?

Posted: Wed May 31, 2017 7:29 am
by Giovanni
Hi,

Is there a DMA conflict? check the channel assigned in mcuconf.h.

Moved in STM32 support.

Giovanni

Re: adcStart breaks i2c on stm32l432 ?

Posted: Wed May 31, 2017 12:51 pm
by geoffrey.brown
There doesn't seem to be a channel conflict -- ADC1 is on channel 1, I2C1 on channels 6 & 7.

Geoffrey

Re: adcStart breaks i2c on stm32l432 ?

Posted: Wed May 31, 2017 8:01 pm
by Giovanni
I have no clue of what could cause this...

Is it just adcStart() or also some pin mode change or other things?

Giovanni

Re: adcStart breaks i2c on stm32l432 ?

Posted: Wed May 31, 2017 8:14 pm
by geoffrey.brown
Just executing adcStart is sufficient to break I2C.
Geoffrey

Re: adcStart breaks i2c on stm32l432 ?

Posted: Wed May 31, 2017 8:25 pm
by Giovanni
Is adcStart() placed before i2cStart() or after? does it make a difference? are debug options enabled in chconf.h?

Giovanni

Re: adcStart breaks i2c on stm32l432 ?

Posted: Thu Jun 01, 2017 7:49 am
by alex31
Students of mine have made a project, (an autonomous stoplight for bicycle) using stm32l432, they use I²C for IMU access, and ADC for testing battery level, and they did not mention me any incompatibility problem between I²C and ADC on stm32l432.

Alexandre

Re: adcStart breaks i2c on stm32l432 ?

Posted: Thu Jun 01, 2017 12:17 pm
by geoffrey.brown
I look elsewhere in my code for the problem.
Geoffrey

Re: adcStart breaks i2c on stm32l432 ?

Posted: Thu Jun 01, 2017 3:14 pm
by RoccoMarco
You could also share us the main...