adcStart breaks i2c on stm32l432 ?

ChibiOS public support forum for topics related to the STMicroelectronics STM32 family of micro-controllers.

Moderator: RoccoMarco

Post Reply
geoffrey.brown
Posts: 122
Joined: Thu May 07, 2015 9:47 pm
Has thanked: 3 times
Been thanked: 18 times

adcStart breaks i2c on stm32l432 ?

Post 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
User avatar
Giovanni
Site Admin
Posts: 14893
Joined: Wed May 27, 2009 8:48 am
Has thanked: 1202 times
Been thanked: 997 times

Re: adcStart breaks i2c on stm32l432 ?

Post by Giovanni »

Hi,

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

Moved in STM32 support.

Giovanni
geoffrey.brown
Posts: 122
Joined: Thu May 07, 2015 9:47 pm
Has thanked: 3 times
Been thanked: 18 times

Re: adcStart breaks i2c on stm32l432 ?

Post by geoffrey.brown »

There doesn't seem to be a channel conflict -- ADC1 is on channel 1, I2C1 on channels 6 & 7.

Geoffrey
User avatar
Giovanni
Site Admin
Posts: 14893
Joined: Wed May 27, 2009 8:48 am
Has thanked: 1202 times
Been thanked: 997 times

Re: adcStart breaks i2c on stm32l432 ?

Post 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
geoffrey.brown
Posts: 122
Joined: Thu May 07, 2015 9:47 pm
Has thanked: 3 times
Been thanked: 18 times

Re: adcStart breaks i2c on stm32l432 ?

Post by geoffrey.brown »

Just executing adcStart is sufficient to break I2C.
Geoffrey
User avatar
Giovanni
Site Admin
Posts: 14893
Joined: Wed May 27, 2009 8:48 am
Has thanked: 1202 times
Been thanked: 997 times

Re: adcStart breaks i2c on stm32l432 ?

Post by Giovanni »

Is adcStart() placed before i2cStart() or after? does it make a difference? are debug options enabled in chconf.h?

Giovanni
User avatar
alex31
Posts: 445
Joined: Fri May 25, 2012 10:23 am
Has thanked: 57 times
Been thanked: 88 times

Re: adcStart breaks i2c on stm32l432 ?

Post 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
geoffrey.brown
Posts: 122
Joined: Thu May 07, 2015 9:47 pm
Has thanked: 3 times
Been thanked: 18 times

Re: adcStart breaks i2c on stm32l432 ?

Post by geoffrey.brown »

I look elsewhere in my code for the problem.
Geoffrey
User avatar
RoccoMarco
Posts: 655
Joined: Wed Apr 24, 2013 4:11 pm
Has thanked: 83 times
Been thanked: 67 times

Re: adcStart breaks i2c on stm32l432 ?

Post by RoccoMarco »

You could also share us the main...
Post Reply