# STM32 Development

**URL:** <https://community.openenergymonitor.org/t/stm32-development/6815>\
**Category:** Hardware\
**Tags:** stm32, development\
**Created:** [12 March 2018 17:30 UTC](https://community.openenergymonitor.org/t/stm32-development/6815 "2018-03-12T17:30:28Z")\
**Posts on this page:** 20\
**Page:** 4

<div class="post-metadata">

**Author:** ![pb66](https://community.openenergymonitor.org/user_avatar/community.openenergymonitor.org/pb66/32/27_2.png) [@pb66](https://community.openenergymonitor.org/u/pb66)\
**Post date:** [24 March 2018 20:31 UTC](https://community.openenergymonitor.org/t/stm32-development/6815/62 "2018-03-24T20:31:05Z")

</div>

> [@Paul](#):
>
> actually it couldn’t be easier

Actually it could be easier

```auto
sudo apt-get install -y gcc-arm-none-eabi

```

saves you having to press “y” to confirm to install 😄

But yes you are right that’s why I was spitting bullets the other day after trying and failing several complex guides multiple times. It just isn’t that complicated. I’m glad to hear you’ve got that sorted now, I feel your pain.

---

<div class="post-metadata">

**Author:** ![TrystanLea](https://community.openenergymonitor.org/user_avatar/community.openenergymonitor.org/trystanlea/32/31_2.png) [@TrystanLea](https://community.openenergymonitor.org/u/TrystanLea)\
**Post date:** [24 March 2018 20:49 UTC](https://community.openenergymonitor.org/t/stm32-development/6815/63 "2018-03-24T20:49:28Z")

</div>

Where does sudo apt-get install gcc-arm-none-eabi, install the toolchain for you? what do you put in the makefile? I had this working with the download binary directly from arm [https://developer.arm.com/open-source/gnu-toolchain/gnu-rm/downloads](https://developer.arm.com/open-source/gnu-toolchain/gnu-rm/downloads) approach but interested to test the sudo apt-get approach

---

<div class="post-metadata">

**Author:** ![Paul](https://community.openenergymonitor.org/user_avatar/community.openenergymonitor.org/paul/32/28_2.png) [@Paul](https://community.openenergymonitor.org/u/Paul)\
**Post date:** [24 March 2018 20:58 UTC](https://community.openenergymonitor.org/t/stm32-development/6815/64 "2018-03-24T20:58:34Z")

</div>

It’s installed in /usr/bin by default.  
The makefile is generated by CubeMX

Paul

---

<div class="post-metadata">

**Author:** ![pb66](https://community.openenergymonitor.org/user_avatar/community.openenergymonitor.org/pb66/32/27_2.png) [@pb66](https://community.openenergymonitor.org/u/pb66)\
**Post date:** [24 March 2018 20:58 UTC](https://community.openenergymonitor.org/t/stm32-development/6815/65 "2018-03-24T20:58:36Z")

</div>

The binaries seem to be in `/usr/bin`

```auto
pi@raspberrypi:~/emonTxshield $ ls -la /usr/bin/arm-none-eabi*
-rwxr-xr-x 1 root root 652692 Oct 28 2016 /usr/bin/arm-none-eabi-addr2line
-rwxr-xr-x 2 root root 673120 Oct 28 2016 /usr/bin/arm-none-eabi-ar
-rwxr-xr-x 2 root root 1146792 Oct 28 2016 /usr/bin/arm-none-eabi-as
-rwxr-xr-x 2 root root 704640 Oct 14 2016 /usr/bin/arm-none-eabi-c++
-rwxr-xr-x 1 root root 652500 Oct 28 2016 /usr/bin/arm-none-eabi-c++filt
-rwxr-xr-x 1 root root 704640 Oct 14 2016 /usr/bin/arm-none-eabi-cpp
-rwxr-xr-x 1 root root 22328 Oct 28 2016 /usr/bin/arm-none-eabi-elfedit
-rwxr-xr-x 2 root root 704640 Oct 14 2016 /usr/bin/arm-none-eabi-g++
-rwxr-xr-x 2 root root 704640 Oct 14 2016 /usr/bin/arm-none-eabi-gcc
-rwxr-xr-x 2 root root 704640 Oct 14 2016 /usr/bin/arm-none-eabi-gcc-5.4.1
-rwxr-xr-x 1 root root 26368 Oct 14 2016 /usr/bin/arm-none-eabi-gcc-ar
-rwxr-xr-x 1 root root 26368 Oct 14 2016 /usr/bin/arm-none-eabi-gcc-nm
-rwxr-xr-x 1 root root 26368 Oct 14 2016 /usr/bin/arm-none-eabi-gcc-ranlib
-rwxr-xr-x 1 root root 399944 Oct 14 2016 /usr/bin/arm-none-eabi-gcov
-rwxr-xr-x 1 root root 367172 Oct 14 2016 /usr/bin/arm-none-eabi-gcov-tool
-rwxr-xr-x 1 root root 714812 Oct 28 2016 /usr/bin/arm-none-eabi-gprof
-rwxr-xr-x 4 root root 984784 Oct 28 2016 /usr/bin/arm-none-eabi-ld
-rwxr-xr-x 4 root root 984784 Oct 28 2016 /usr/bin/arm-none-eabi-ld.bfd
-rwxr-xr-x 2 root root 661220 Oct 28 2016 /usr/bin/arm-none-eabi-nm
-rwxr-xr-x 2 root root 810188 Oct 28 2016 /usr/bin/arm-none-eabi-objcopy
-rwxr-xr-x 2 root root 1028356 Oct 28 2016 /usr/bin/arm-none-eabi-objdump
-rwxr-xr-x 2 root root 673128 Oct 28 2016 /usr/bin/arm-none-eabi-ranlib
-rwxr-xr-x 2 root root 419492 Oct 28 2016 /usr/bin/arm-none-eabi-readelf
-rwxr-xr-x 1 root root 652636 Oct 28 2016 /usr/bin/arm-none-eabi-size
-rwxr-xr-x 1 root root 652692 Oct 28 2016 /usr/bin/arm-none-eabi-strings
-rwxr-xr-x 2 root root 810196 Oct 28 2016 /usr/bin/arm-none-eabi-strip
pi@raspberrypi:~/emonTxshield $ ls -la /usr/lib/arm-none-eabi
total 20
drwxr-xr-x 5 root root 4096 Mar 22 17:47 .
drwxr-xr-x 83 root root 4096 Mar 22 17:45 ..
drwxr-xr-x 2 root root 4096 Mar 22 17:45 bin
lrwxrwxrwx 1 root root 43 Mar 22 17:47 include -> /etc/alternatives/gcc-arm-none-eabi-include
drwxr-xr-x 2 root root 4096 Mar 22 17:45 ldscripts
lrwxrwxrwx 1 root root 39 Mar 22 17:47 lib -> /etc/alternatives/gcc-arm-none-eabi-lib
drwxr-xr-x 8 root root 4096 Mar 22 17:47 newlib

```

but although it in in the users PATH

```auto
pi@raspberrypi:~/emonTxshield $ arm-none-eabi-gcc --version
arm-none-eabi-gcc (15:5.4.1+svn241155-1) 5.4.1 20160919
Copyright (C) 2015 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

```

it seem dBC’s BINPATH fix is required to get the other options in there to compile rather than just editing Makefile

---

<div class="post-metadata">

**Author:** ![TrystanLea](https://community.openenergymonitor.org/user_avatar/community.openenergymonitor.org/trystanlea/32/31_2.png) [@TrystanLea](https://community.openenergymonitor.org/u/TrystanLea)\
**Post date:** [24 March 2018 21:00 UTC](https://community.openenergymonitor.org/t/stm32-development/6815/66 "2018-03-24T21:00:33Z")

</div>

perfect, compiles fine, much simpler than downloading the binaries from arm, thanks!

---

<div class="post-metadata">

**Author:** ![Robert.Wall](https://community.openenergymonitor.org/user_avatar/community.openenergymonitor.org/robert.wall/32/38246_2.png) [@Robert.Wall](https://community.openenergymonitor.org/u/Robert.Wall)\
**Post date:** [24 March 2018 21:33 UTC](https://community.openenergymonitor.org/t/stm32-development/6815/68 "2018-03-24T21:33:04Z")

</div>

What I did was:

1. Throw away my first attempt at the tutorial.
2. Start from the top, setting up the ADC etc in STM32CubeMX
3. Stopped at the end of post 38 with the changes to the Makefile, and hit Make.

The Makefile lists, under ‘paths’:  
Application/User/Src/adc.c **and twice** under ‘C sources’: Src/adc.c  
[presumably the same, but I can’t see where the mapping “Application/User” is done, and nowhere do I have a “Application” directory]

_[Question: Why are files listed under “paths”? I smell a problem.]_

Under ‘C sources’ it lists:  
Src/gpio.c **twice**  
Src/dma.c **twice**  
Src/usart.c **twice**  
Src/main.c **twice**

Peculiarly, I don’t get multiple definitions when I have gpio.c, usart.c dma.c or main.c twice, it’s only adc.c that triggers the multiple definitions errors.

I was looking at the Makefile for emonTxshield and comparing the two, to try to spot where the multiple definitions were coming from, and thought I’d better prove it was OK first. Wrong!

  
Having got V3... If I run make on the untouched unzipped version, it compiles OK up to: make: \*\*\* No rule to make target 'build/startup\_stm32f303xe.o', needed by 'build/emonTxshield.elf'. Stop.

It appears from the list of object files in .map that that’s the only one it couldn’t/didn’t compile.

When I went back to the .ioc file and did “Generate Code”, it complained that my version of STM ws later than yours, @dBC.

---

<div class="post-metadata">

**Author:** ![Robert.Wall](https://community.openenergymonitor.org/user_avatar/community.openenergymonitor.org/robert.wall/32/38246_2.png) [@Robert.Wall](https://community.openenergymonitor.org/u/Robert.Wall)\
**Post date:** [24 March 2018 21:44 UTC](https://community.openenergymonitor.org/t/stm32-development/6815/69 "2018-03-24T21:44:27Z")

</div>

> [@Paul](#):
>
> Just unzipped your file @pb66 , and that seemed to compile OK, I just got a few warnings about ‘incompatible implicit declarations’, but largely OK,

Me too! - so my toolchain is OK too.  
Mine complained about ‘strlen’

---

<div class="post-metadata">

**Author:** ![dBC](https://community.openenergymonitor.org/letter_avatar_proxy/v4/letter/d/5f9b8f/32.png) [@dBC](https://community.openenergymonitor.org/u/dBC)\
**Post date:** [24 March 2018 21:46 UTC](https://community.openenergymonitor.org/t/stm32-development/6815/70 "2018-03-24T21:46:33Z")

</div>

hmm… I think most of these problems have been caused by me being selective about what I put in the tarfile… not sure why I did that, but it’s clearly not a good idea. This time I’ve gone up one layer into the Projects directory and made a complete tar of emonTxshield. Hopefully this will sort it: [txshield\_demo\_4.tar.gz](https://community.openenergymonitor.org/uploads/default/original/2X/3/314ac8e8e6d2140b7960063d36ca63037c0424f7.gz) (810.9 KB)

> [@Robert.Wall](#):
>
> When I went back to the .ioc file and did “Generate Code”, it complained that my version of STM ws later than yours, @dBC.

Guess I better bring mine up to date then… not something I ever look forward to for fear I too will end up in the same tools hell the rest of you are in ☹

---

<div class="post-metadata">

**Author:** ![dBC](https://community.openenergymonitor.org/letter_avatar_proxy/v4/letter/d/5f9b8f/32.png) [@dBC](https://community.openenergymonitor.org/u/dBC)\
**Post date:** [24 March 2018 21:50 UTC](https://community.openenergymonitor.org/t/stm32-development/6815/71 "2018-03-24T21:50:14Z")

</div>

> [@Robert.Wall](#):
>
> Mine complained about ‘strlen’

hmm… I seem to get a completely clean build with no warnings, which is what I always aim for. Can you tell which file it’s trying to compile when you get the strlen warning?

---

<div class="post-metadata">

**Author:** ![Robert.Wall](https://community.openenergymonitor.org/user_avatar/community.openenergymonitor.org/robert.wall/32/38246_2.png) [@Robert.Wall](https://community.openenergymonitor.org/u/Robert.Wall)\
**Post date:** [24 March 2018 21:54 UTC](https://community.openenergymonitor.org/t/stm32-development/6815/72 "2018-03-24T21:54:10Z")

</div>

Src/usart.c:128

---

<div class="post-metadata">

**Author:** ![dBC](https://community.openenergymonitor.org/letter_avatar_proxy/v4/letter/d/5f9b8f/32.png) [@dBC](https://community.openenergymonitor.org/u/dBC)\
**Post date:** [24 March 2018 22:01 UTC](https://community.openenergymonitor.org/t/stm32-development/6815/73 "2018-03-24T22:01:30Z")

</div>

That’s very strange. And your usart.c includes \<string.h\>? Mine’s quite clean:

```
$ touch Src/usart.c 
$ make
/usr/bin/arm-none-eabi-gcc -c -mcpu=cortex-m4 -mthumb -mfpu=fpv4-sp-d16 -mfloat-abi=hard -DUSE_HAL_DRIVER -DSTM32F303xE -IInc -IDrivers/STM32F3xx_HAL_Driver/Inc -IDrivers/STM32F3xx_HAL_Driver/Inc/Legacy -IDrivers/CMSIS/Device/ST/STM32F3xx/Include -IDrivers/CMSIS/Include -Og -Wall -fdata-sections -ffunction-sections -g -gdwarf-2 -MMD -MP -MF"build/usart.d" -MT"build/usart.d" -std=gnu99 -Wa,-a,-ad,-alms=build/usart.lst Src/usart.c -o build/usart.o
/usr/bin/arm-none-eabi-gcc build/adc.o build/power.o build/stm32f3xx_hal_msp.o build/stm32f3xx_hal_uart.o build/stm32f3xx_hal_adc_ex.o build/stm32f3xx_hal_adc.o build/stm32f3xx_hal_tim.o build/stm32f3xx_hal_gpio.o build/usart.o build/stm32f3xx_hal_rcc_ex.o build/gpio.o build/stm32f3xx_hal_i2c.o build/stm32f3xx_hal_pwr.o build/stm32f3xx_hal_flash_ex.o build/stm32f3xx_hal_cortex.o build/main.o build/stm32f3xx_it.o build/stm32f3xx_hal_dma.o build/system_stm32f3xx.o build/dma.o build/stm32f3xx_hal_tim_ex.o build/tim.o build/stm32f3xx_hal_uart_ex.o build/stm32f3xx_hal_rcc.o build/stm32f3xx_hal_flash.o build/stm32f3xx_hal_pwr_ex.o build/stm32f3xx_hal.o build/stm32f3xx_hal_i2c_ex.o build/startup_stm32f303xe.o -mcpu=cortex-m4 -mthumb -mfpu=fpv4-sp-d16 -mfloat-abi=hard -specs=nano.specs -TSTM32F303RETx_FLASH.ld -lc -lm -lnosys -Wl,-Map=build/emonTxshield.map,--cref -Wl,--gc-sections -Xlinker --no-wchar-size-warning -u _printf_float -o build/emonTxshield.elf
/usr/bin/arm-none-eabi-size build/emonTxshield.elf
   text data bss dec hex	filename
  27576 172 5908 33656 8378	build/emonTxshield.elf
/usr/bin/arm-none-eabi-objcopy -O ihex build/emonTxshield.elf build/emonTxshield.hex
/usr/bin/arm-none-eabi-objcopy -O binary -S build/emonTxshield.elf build/emonTxshield.bin	
$
```

---

<div class="post-metadata">

**Author:** ![pb66](https://community.openenergymonitor.org/user_avatar/community.openenergymonitor.org/pb66/32/27_2.png) [@pb66](https://community.openenergymonitor.org/u/pb66)\
**Post date:** [24 March 2018 22:11 UTC](https://community.openenergymonitor.org/t/stm32-development/6815/74 "2018-03-24T22:11:06Z")

</div>

I think you’re looking at different projects. Robert is looking at my “stm32tests/stm32test1” which is my copy of the original tutorial, and you are looking at the “emonTxshield” presumably v4.

I have just recompiled my “stm32tests/stm32test1” which Robert is getting the strlen warning and this is the full print

```auto
pi@raspberrypi:~/emonTxshield $ make
mkdir build
/usr/bin/arm-none-eabi-gcc -c -mcpu=cortex-m4 -mthumb -mfpu=fpv4-sp-d16 -mfloat-abi=hard -DUSE_HAL_DRIVER -DSTM32F303xE -IInc -IDrivers/STM32F3xx_HAL_Driver/Inc -IDrivers/STM32F3xx_HAL_Driver/Inc/Legacy -IDrivers/CMSIS/Device/ST/STM32F3xx/Include -IDrivers/CMSIS/Include -Og -Wall -fdata-sections -ffunction-sections -g -gdwarf-2 -MMD -MP -MF"build/adc.d" -MT"build/adc.d" -std=gnu99 -Wa,-a,-ad,-alms=build/adc.lst Src/adc.c -o build/adc.o
/usr/bin/arm-none-eabi-gcc -c -mcpu=cortex-m4 -mthumb -mfpu=fpv4-sp-d16 -mfloat-abi=hard -DUSE_HAL_DRIVER -DSTM32F303xE -IInc -IDrivers/STM32F3xx_HAL_Driver/Inc -IDrivers/STM32F3xx_HAL_Driver/Inc/Legacy -IDrivers/CMSIS/Device/ST/STM32F3xx/Include -IDrivers/CMSIS/Include -Og -Wall -fdata-sections -ffunction-sections -g -gdwarf-2 -MMD -MP -MF"build/power.d" -MT"build/power.d" -std=gnu99 -Wa,-a,-ad,-alms=build/power.lst Src/power.c -o build/power.o
/usr/bin/arm-none-eabi-gcc -c -mcpu=cortex-m4 -mthumb -mfpu=fpv4-sp-d16 -mfloat-abi=hard -DUSE_HAL_DRIVER -DSTM32F303xE -IInc -IDrivers/STM32F3xx_HAL_Driver/Inc -IDrivers/STM32F3xx_HAL_Driver/Inc/Legacy -IDrivers/CMSIS/Device/ST/STM32F3xx/Include -IDrivers/CMSIS/Include -Og -Wall -fdata-sections -ffunction-sections -g -gdwarf-2 -MMD -MP -MF"build/stm32f3xx_hal_msp.d" -MT"build/stm32f3xx_hal_msp.d" -std=gnu99 -Wa,-a,-ad,-alms=build/stm32f3xx_hal_msp.lst Src/stm32f3xx_hal_msp.c -o build/stm32f3xx_hal_msp.o
/usr/bin/arm-none-eabi-gcc -c -mcpu=cortex-m4 -mthumb -mfpu=fpv4-sp-d16 -mfloat-abi=hard -DUSE_HAL_DRIVER -DSTM32F303xE -IInc -IDrivers/STM32F3xx_HAL_Driver/Inc -IDrivers/STM32F3xx_HAL_Driver/Inc/Legacy -IDrivers/CMSIS/Device/ST/STM32F3xx/Include -IDrivers/CMSIS/Include -Og -Wall -fdata-sections -ffunction-sections -g -gdwarf-2 -MMD -MP -MF"build/stm32f3xx_hal_uart.d" -MT"build/stm32f3xx_hal_uart.d" -std=gnu99 -Wa,-a,-ad,-alms=build/stm32f3xx_hal_uart.lst Drivers/STM32F3xx_HAL_Driver/Src/stm32f3xx_hal_uart.c -o build/stm32f3xx_hal_uart.o
/usr/bin/arm-none-eabi-gcc -c -mcpu=cortex-m4 -mthumb -mfpu=fpv4-sp-d16 -mfloat-abi=hard -DUSE_HAL_DRIVER -DSTM32F303xE -IInc -IDrivers/STM32F3xx_HAL_Driver/Inc -IDrivers/STM32F3xx_HAL_Driver/Inc/Legacy -IDrivers/CMSIS/Device/ST/STM32F3xx/Include -IDrivers/CMSIS/Include -Og -Wall -fdata-sections -ffunction-sections -g -gdwarf-2 -MMD -MP -MF"build/stm32f3xx_hal_adc_ex.d" -MT"build/stm32f3xx_hal_adc_ex.d" -std=gnu99 -Wa,-a,-ad,-alms=build/stm32f3xx_hal_adc_ex.lst Drivers/STM32F3xx_HAL_Driver/Src/stm32f3xx_hal_adc_ex.c -o build/stm32f3xx_hal_adc_ex.o
/usr/bin/arm-none-eabi-gcc -c -mcpu=cortex-m4 -mthumb -mfpu=fpv4-sp-d16 -mfloat-abi=hard -DUSE_HAL_DRIVER -DSTM32F303xE -IInc -IDrivers/STM32F3xx_HAL_Driver/Inc -IDrivers/STM32F3xx_HAL_Driver/Inc/Legacy -IDrivers/CMSIS/Device/ST/STM32F3xx/Include -IDrivers/CMSIS/Include -Og -Wall -fdata-sections -ffunction-sections -g -gdwarf-2 -MMD -MP -MF"build/stm32f3xx_hal_adc.d" -MT"build/stm32f3xx_hal_adc.d" -std=gnu99 -Wa,-a,-ad,-alms=build/stm32f3xx_hal_adc.lst Drivers/STM32F3xx_HAL_Driver/Src/stm32f3xx_hal_adc.c -o build/stm32f3xx_hal_adc.o
/usr/bin/arm-none-eabi-gcc -c -mcpu=cortex-m4 -mthumb -mfpu=fpv4-sp-d16 -mfloat-abi=hard -DUSE_HAL_DRIVER -DSTM32F303xE -IInc -IDrivers/STM32F3xx_HAL_Driver/Inc -IDrivers/STM32F3xx_HAL_Driver/Inc/Legacy -IDrivers/CMSIS/Device/ST/STM32F3xx/Include -IDrivers/CMSIS/Include -Og -Wall -fdata-sections -ffunction-sections -g -gdwarf-2 -MMD -MP -MF"build/stm32f3xx_hal_tim.d" -MT"build/stm32f3xx_hal_tim.d" -std=gnu99 -Wa,-a,-ad,-alms=build/stm32f3xx_hal_tim.lst Drivers/STM32F3xx_HAL_Driver/Src/stm32f3xx_hal_tim.c -o build/stm32f3xx_hal_tim.o
/usr/bin/arm-none-eabi-gcc -c -mcpu=cortex-m4 -mthumb -mfpu=fpv4-sp-d16 -mfloat-abi=hard -DUSE_HAL_DRIVER -DSTM32F303xE -IInc -IDrivers/STM32F3xx_HAL_Driver/Inc -IDrivers/STM32F3xx_HAL_Driver/Inc/Legacy -IDrivers/CMSIS/Device/ST/STM32F3xx/Include -IDrivers/CMSIS/Include -Og -Wall -fdata-sections -ffunction-sections -g -gdwarf-2 -MMD -MP -MF"build/stm32f3xx_hal_gpio.d" -MT"build/stm32f3xx_hal_gpio.d" -std=gnu99 -Wa,-a,-ad,-alms=build/stm32f3xx_hal_gpio.lst Drivers/STM32F3xx_HAL_Driver/Src/stm32f3xx_hal_gpio.c -o build/stm32f3xx_hal_gpio.o
/usr/bin/arm-none-eabi-gcc -c -mcpu=cortex-m4 -mthumb -mfpu=fpv4-sp-d16 -mfloat-abi=hard -DUSE_HAL_DRIVER -DSTM32F303xE -IInc -IDrivers/STM32F3xx_HAL_Driver/Inc -IDrivers/STM32F3xx_HAL_Driver/Inc/Legacy -IDrivers/CMSIS/Device/ST/STM32F3xx/Include -IDrivers/CMSIS/Include -Og -Wall -fdata-sections -ffunction-sections -g -gdwarf-2 -MMD -MP -MF"build/usart.d" -MT"build/usart.d" -std=gnu99 -Wa,-a,-ad,-alms=build/usart.lst Src/usart.c -o build/usart.o
/usr/bin/arm-none-eabi-gcc -c -mcpu=cortex-m4 -mthumb -mfpu=fpv4-sp-d16 -mfloat-abi=hard -DUSE_HAL_DRIVER -DSTM32F303xE -IInc -IDrivers/STM32F3xx_HAL_Driver/Inc -IDrivers/STM32F3xx_HAL_Driver/Inc/Legacy -IDrivers/CMSIS/Device/ST/STM32F3xx/Include -IDrivers/CMSIS/Include -Og -Wall -fdata-sections -ffunction-sections -g -gdwarf-2 -MMD -MP -MF"build/stm32f3xx_hal_rcc_ex.d" -MT"build/stm32f3xx_hal_rcc_ex.d" -std=gnu99 -Wa,-a,-ad,-alms=build/stm32f3xx_hal_rcc_ex.lst Drivers/STM32F3xx_HAL_Driver/Src/stm32f3xx_hal_rcc_ex.c -o build/stm32f3xx_hal_rcc_ex.o
/usr/bin/arm-none-eabi-gcc -c -mcpu=cortex-m4 -mthumb -mfpu=fpv4-sp-d16 -mfloat-abi=hard -DUSE_HAL_DRIVER -DSTM32F303xE -IInc -IDrivers/STM32F3xx_HAL_Driver/Inc -IDrivers/STM32F3xx_HAL_Driver/Inc/Legacy -IDrivers/CMSIS/Device/ST/STM32F3xx/Include -IDrivers/CMSIS/Include -Og -Wall -fdata-sections -ffunction-sections -g -gdwarf-2 -MMD -MP -MF"build/gpio.d" -MT"build/gpio.d" -std=gnu99 -Wa,-a,-ad,-alms=build/gpio.lst Src/gpio.c -o build/gpio.o
/usr/bin/arm-none-eabi-gcc -c -mcpu=cortex-m4 -mthumb -mfpu=fpv4-sp-d16 -mfloat-abi=hard -DUSE_HAL_DRIVER -DSTM32F303xE -IInc -IDrivers/STM32F3xx_HAL_Driver/Inc -IDrivers/STM32F3xx_HAL_Driver/Inc/Legacy -IDrivers/CMSIS/Device/ST/STM32F3xx/Include -IDrivers/CMSIS/Include -Og -Wall -fdata-sections -ffunction-sections -g -gdwarf-2 -MMD -MP -MF"build/stm32f3xx_hal_i2c.d" -MT"build/stm32f3xx_hal_i2c.d" -std=gnu99 -Wa,-a,-ad,-alms=build/stm32f3xx_hal_i2c.lst Drivers/STM32F3xx_HAL_Driver/Src/stm32f3xx_hal_i2c.c -o build/stm32f3xx_hal_i2c.o
/usr/bin/arm-none-eabi-gcc -c -mcpu=cortex-m4 -mthumb -mfpu=fpv4-sp-d16 -mfloat-abi=hard -DUSE_HAL_DRIVER -DSTM32F303xE -IInc -IDrivers/STM32F3xx_HAL_Driver/Inc -IDrivers/STM32F3xx_HAL_Driver/Inc/Legacy -IDrivers/CMSIS/Device/ST/STM32F3xx/Include -IDrivers/CMSIS/Include -Og -Wall -fdata-sections -ffunction-sections -g -gdwarf-2 -MMD -MP -MF"build/stm32f3xx_hal_pwr.d" -MT"build/stm32f3xx_hal_pwr.d" -std=gnu99 -Wa,-a,-ad,-alms=build/stm32f3xx_hal_pwr.lst Drivers/STM32F3xx_HAL_Driver/Src/stm32f3xx_hal_pwr.c -o build/stm32f3xx_hal_pwr.o
/usr/bin/arm-none-eabi-gcc -c -mcpu=cortex-m4 -mthumb -mfpu=fpv4-sp-d16 -mfloat-abi=hard -DUSE_HAL_DRIVER -DSTM32F303xE -IInc -IDrivers/STM32F3xx_HAL_Driver/Inc -IDrivers/STM32F3xx_HAL_Driver/Inc/Legacy -IDrivers/CMSIS/Device/ST/STM32F3xx/Include -IDrivers/CMSIS/Include -Og -Wall -fdata-sections -ffunction-sections -g -gdwarf-2 -MMD -MP -MF"build/stm32f3xx_hal_flash_ex.d" -MT"build/stm32f3xx_hal_flash_ex.d" -std=gnu99 -Wa,-a,-ad,-alms=build/stm32f3xx_hal_flash_ex.lst Drivers/STM32F3xx_HAL_Driver/Src/stm32f3xx_hal_flash_ex.c -o build/stm32f3xx_hal_flash_ex.o
/usr/bin/arm-none-eabi-gcc -c -mcpu=cortex-m4 -mthumb -mfpu=fpv4-sp-d16 -mfloat-abi=hard -DUSE_HAL_DRIVER -DSTM32F303xE -IInc -IDrivers/STM32F3xx_HAL_Driver/Inc -IDrivers/STM32F3xx_HAL_Driver/Inc/Legacy -IDrivers/CMSIS/Device/ST/STM32F3xx/Include -IDrivers/CMSIS/Include -Og -Wall -fdata-sections -ffunction-sections -g -gdwarf-2 -MMD -MP -MF"build/stm32f3xx_hal_cortex.d" -MT"build/stm32f3xx_hal_cortex.d" -std=gnu99 -Wa,-a,-ad,-alms=build/stm32f3xx_hal_cortex.lst Drivers/STM32F3xx_HAL_Driver/Src/stm32f3xx_hal_cortex.c -o build/stm32f3xx_hal_cortex.o
/usr/bin/arm-none-eabi-gcc -c -mcpu=cortex-m4 -mthumb -mfpu=fpv4-sp-d16 -mfloat-abi=hard -DUSE_HAL_DRIVER -DSTM32F303xE -IInc -IDrivers/STM32F3xx_HAL_Driver/Inc -IDrivers/STM32F3xx_HAL_Driver/Inc/Legacy -IDrivers/CMSIS/Device/ST/STM32F3xx/Include -IDrivers/CMSIS/Include -Og -Wall -fdata-sections -ffunction-sections -g -gdwarf-2 -MMD -MP -MF"build/main.d" -MT"build/main.d" -std=gnu99 -Wa,-a,-ad,-alms=build/main.lst Src/main.c -o build/main.o
/usr/bin/arm-none-eabi-gcc -c -mcpu=cortex-m4 -mthumb -mfpu=fpv4-sp-d16 -mfloat-abi=hard -DUSE_HAL_DRIVER -DSTM32F303xE -IInc -IDrivers/STM32F3xx_HAL_Driver/Inc -IDrivers/STM32F3xx_HAL_Driver/Inc/Legacy -IDrivers/CMSIS/Device/ST/STM32F3xx/Include -IDrivers/CMSIS/Include -Og -Wall -fdata-sections -ffunction-sections -g -gdwarf-2 -MMD -MP -MF"build/stm32f3xx_it.d" -MT"build/stm32f3xx_it.d" -std=gnu99 -Wa,-a,-ad,-alms=build/stm32f3xx_it.lst Src/stm32f3xx_it.c -o build/stm32f3xx_it.o
/usr/bin/arm-none-eabi-gcc -c -mcpu=cortex-m4 -mthumb -mfpu=fpv4-sp-d16 -mfloat-abi=hard -DUSE_HAL_DRIVER -DSTM32F303xE -IInc -IDrivers/STM32F3xx_HAL_Driver/Inc -IDrivers/STM32F3xx_HAL_Driver/Inc/Legacy -IDrivers/CMSIS/Device/ST/STM32F3xx/Include -IDrivers/CMSIS/Include -Og -Wall -fdata-sections -ffunction-sections -g -gdwarf-2 -MMD -MP -MF"build/stm32f3xx_hal_dma.d" -MT"build/stm32f3xx_hal_dma.d" -std=gnu99 -Wa,-a,-ad,-alms=build/stm32f3xx_hal_dma.lst Drivers/STM32F3xx_HAL_Driver/Src/stm32f3xx_hal_dma.c -o build/stm32f3xx_hal_dma.o
/usr/bin/arm-none-eabi-gcc -c -mcpu=cortex-m4 -mthumb -mfpu=fpv4-sp-d16 -mfloat-abi=hard -DUSE_HAL_DRIVER -DSTM32F303xE -IInc -IDrivers/STM32F3xx_HAL_Driver/Inc -IDrivers/STM32F3xx_HAL_Driver/Inc/Legacy -IDrivers/CMSIS/Device/ST/STM32F3xx/Include -IDrivers/CMSIS/Include -Og -Wall -fdata-sections -ffunction-sections -g -gdwarf-2 -MMD -MP -MF"build/system_stm32f3xx.d" -MT"build/system_stm32f3xx.d" -std=gnu99 -Wa,-a,-ad,-alms=build/system_stm32f3xx.lst Src/system_stm32f3xx.c -o build/system_stm32f3xx.o
/usr/bin/arm-none-eabi-gcc -c -mcpu=cortex-m4 -mthumb -mfpu=fpv4-sp-d16 -mfloat-abi=hard -DUSE_HAL_DRIVER -DSTM32F303xE -IInc -IDrivers/STM32F3xx_HAL_Driver/Inc -IDrivers/STM32F3xx_HAL_Driver/Inc/Legacy -IDrivers/CMSIS/Device/ST/STM32F3xx/Include -IDrivers/CMSIS/Include -Og -Wall -fdata-sections -ffunction-sections -g -gdwarf-2 -MMD -MP -MF"build/dma.d" -MT"build/dma.d" -std=gnu99 -Wa,-a,-ad,-alms=build/dma.lst Src/dma.c -o build/dma.o
/usr/bin/arm-none-eabi-gcc -c -mcpu=cortex-m4 -mthumb -mfpu=fpv4-sp-d16 -mfloat-abi=hard -DUSE_HAL_DRIVER -DSTM32F303xE -IInc -IDrivers/STM32F3xx_HAL_Driver/Inc -IDrivers/STM32F3xx_HAL_Driver/Inc/Legacy -IDrivers/CMSIS/Device/ST/STM32F3xx/Include -IDrivers/CMSIS/Include -Og -Wall -fdata-sections -ffunction-sections -g -gdwarf-2 -MMD -MP -MF"build/stm32f3xx_hal_tim_ex.d" -MT"build/stm32f3xx_hal_tim_ex.d" -std=gnu99 -Wa,-a,-ad,-alms=build/stm32f3xx_hal_tim_ex.lst Drivers/STM32F3xx_HAL_Driver/Src/stm32f3xx_hal_tim_ex.c -o build/stm32f3xx_hal_tim_ex.o
/usr/bin/arm-none-eabi-gcc -c -mcpu=cortex-m4 -mthumb -mfpu=fpv4-sp-d16 -mfloat-abi=hard -DUSE_HAL_DRIVER -DSTM32F303xE -IInc -IDrivers/STM32F3xx_HAL_Driver/Inc -IDrivers/STM32F3xx_HAL_Driver/Inc/Legacy -IDrivers/CMSIS/Device/ST/STM32F3xx/Include -IDrivers/CMSIS/Include -Og -Wall -fdata-sections -ffunction-sections -g -gdwarf-2 -MMD -MP -MF"build/tim.d" -MT"build/tim.d" -std=gnu99 -Wa,-a,-ad,-alms=build/tim.lst Src/tim.c -o build/tim.o
/usr/bin/arm-none-eabi-gcc -c -mcpu=cortex-m4 -mthumb -mfpu=fpv4-sp-d16 -mfloat-abi=hard -DUSE_HAL_DRIVER -DSTM32F303xE -IInc -IDrivers/STM32F3xx_HAL_Driver/Inc -IDrivers/STM32F3xx_HAL_Driver/Inc/Legacy -IDrivers/CMSIS/Device/ST/STM32F3xx/Include -IDrivers/CMSIS/Include -Og -Wall -fdata-sections -ffunction-sections -g -gdwarf-2 -MMD -MP -MF"build/stm32f3xx_hal_uart_ex.d" -MT"build/stm32f3xx_hal_uart_ex.d" -std=gnu99 -Wa,-a,-ad,-alms=build/stm32f3xx_hal_uart_ex.lst Drivers/STM32F3xx_HAL_Driver/Src/stm32f3xx_hal_uart_ex.c -o build/stm32f3xx_hal_uart_ex.o
/usr/bin/arm-none-eabi-gcc -c -mcpu=cortex-m4 -mthumb -mfpu=fpv4-sp-d16 -mfloat-abi=hard -DUSE_HAL_DRIVER -DSTM32F303xE -IInc -IDrivers/STM32F3xx_HAL_Driver/Inc -IDrivers/STM32F3xx_HAL_Driver/Inc/Legacy -IDrivers/CMSIS/Device/ST/STM32F3xx/Include -IDrivers/CMSIS/Include -Og -Wall -fdata-sections -ffunction-sections -g -gdwarf-2 -MMD -MP -MF"build/stm32f3xx_hal_rcc.d" -MT"build/stm32f3xx_hal_rcc.d" -std=gnu99 -Wa,-a,-ad,-alms=build/stm32f3xx_hal_rcc.lst Drivers/STM32F3xx_HAL_Driver/Src/stm32f3xx_hal_rcc.c -o build/stm32f3xx_hal_rcc.o
/usr/bin/arm-none-eabi-gcc -c -mcpu=cortex-m4 -mthumb -mfpu=fpv4-sp-d16 -mfloat-abi=hard -DUSE_HAL_DRIVER -DSTM32F303xE -IInc -IDrivers/STM32F3xx_HAL_Driver/Inc -IDrivers/STM32F3xx_HAL_Driver/Inc/Legacy -IDrivers/CMSIS/Device/ST/STM32F3xx/Include -IDrivers/CMSIS/Include -Og -Wall -fdata-sections -ffunction-sections -g -gdwarf-2 -MMD -MP -MF"build/stm32f3xx_hal_flash.d" -MT"build/stm32f3xx_hal_flash.d" -std=gnu99 -Wa,-a,-ad,-alms=build/stm32f3xx_hal_flash.lst Drivers/STM32F3xx_HAL_Driver/Src/stm32f3xx_hal_flash.c -o build/stm32f3xx_hal_flash.o
/usr/bin/arm-none-eabi-gcc -c -mcpu=cortex-m4 -mthumb -mfpu=fpv4-sp-d16 -mfloat-abi=hard -DUSE_HAL_DRIVER -DSTM32F303xE -IInc -IDrivers/STM32F3xx_HAL_Driver/Inc -IDrivers/STM32F3xx_HAL_Driver/Inc/Legacy -IDrivers/CMSIS/Device/ST/STM32F3xx/Include -IDrivers/CMSIS/Include -Og -Wall -fdata-sections -ffunction-sections -g -gdwarf-2 -MMD -MP -MF"build/stm32f3xx_hal_pwr_ex.d" -MT"build/stm32f3xx_hal_pwr_ex.d" -std=gnu99 -Wa,-a,-ad,-alms=build/stm32f3xx_hal_pwr_ex.lst Drivers/STM32F3xx_HAL_Driver/Src/stm32f3xx_hal_pwr_ex.c -o build/stm32f3xx_hal_pwr_ex.o
/usr/bin/arm-none-eabi-gcc -c -mcpu=cortex-m4 -mthumb -mfpu=fpv4-sp-d16 -mfloat-abi=hard -DUSE_HAL_DRIVER -DSTM32F303xE -IInc -IDrivers/STM32F3xx_HAL_Driver/Inc -IDrivers/STM32F3xx_HAL_Driver/Inc/Legacy -IDrivers/CMSIS/Device/ST/STM32F3xx/Include -IDrivers/CMSIS/Include -Og -Wall -fdata-sections -ffunction-sections -g -gdwarf-2 -MMD -MP -MF"build/stm32f3xx_hal.d" -MT"build/stm32f3xx_hal.d" -std=gnu99 -Wa,-a,-ad,-alms=build/stm32f3xx_hal.lst Drivers/STM32F3xx_HAL_Driver/Src/stm32f3xx_hal.c -o build/stm32f3xx_hal.o
/usr/bin/arm-none-eabi-gcc -c -mcpu=cortex-m4 -mthumb -mfpu=fpv4-sp-d16 -mfloat-abi=hard -DUSE_HAL_DRIVER -DSTM32F303xE -IInc -IDrivers/STM32F3xx_HAL_Driver/Inc -IDrivers/STM32F3xx_HAL_Driver/Inc/Legacy -IDrivers/CMSIS/Device/ST/STM32F3xx/Include -IDrivers/CMSIS/Include -Og -Wall -fdata-sections -ffunction-sections -g -gdwarf-2 -MMD -MP -MF"build/stm32f3xx_hal_i2c_ex.d" -MT"build/stm32f3xx_hal_i2c_ex.d" -std=gnu99 -Wa,-a,-ad,-alms=build/stm32f3xx_hal_i2c_ex.lst Drivers/STM32F3xx_HAL_Driver/Src/stm32f3xx_hal_i2c_ex.c -o build/stm32f3xx_hal_i2c_ex.o
make: *** No rule to make target 'build/startup_stm32f303xe.o', needed by 'build/emonTxshield.elf'. Stop.
pi@raspberrypi:~/emonTxshield $ cd ../stm32tests/stm32test1
pi@raspberrypi:~/stm32tests/stm32test1 $ make
make: Nothing to be done for 'all'.
pi@raspberrypi:~/stm32tests/stm32test1 $ make clean
rm -fR .dep build
pi@raspberrypi:~/stm32tests/stm32test1 $ make
mkdir build
/usr/bin/arm-none-eabi-gcc -c -mcpu=cortex-m4 -mthumb -mfpu=fpv4-sp-d16 -mfloat-abi=hard -DUSE_HAL_DRIVER -DSTM32F303xE -IInc -IDrivers/STM32F3xx_HAL_Driver/Inc -IDrivers/STM32F3xx_HAL_Driver/Inc/Legacy -IDrivers/CMSIS/Device/ST/STM32F3xx/Include -IDrivers/CMSIS/Include -Og -Wall -fdata-sections -ffunction-sections -g -gdwarf-2 -MMD -MP -MF"build/stm32f3xx_hal_uart.d" -MT"build/stm32f3xx_hal_uart.d" -std=gnu99 -Wa,-a,-ad,-alms=build/stm32f3xx_hal_uart.lst Drivers/STM32F3xx_HAL_Driver/Src/stm32f3xx_hal_uart.c -o build/stm32f3xx_hal_uart.o
/usr/bin/arm-none-eabi-gcc -c -mcpu=cortex-m4 -mthumb -mfpu=fpv4-sp-d16 -mfloat-abi=hard -DUSE_HAL_DRIVER -DSTM32F303xE -IInc -IDrivers/STM32F3xx_HAL_Driver/Inc -IDrivers/STM32F3xx_HAL_Driver/Inc/Legacy -IDrivers/CMSIS/Device/ST/STM32F3xx/Include -IDrivers/CMSIS/Include -Og -Wall -fdata-sections -ffunction-sections -g -gdwarf-2 -MMD -MP -MF"build/main.d" -MT"build/main.d" -std=gnu99 -Wa,-a,-ad,-alms=build/main.lst Src/main.c -o build/main.o
Src/main.c: In function 'main':
Src/main.c:110:3: warning: implicit declaration of function 'debug_printf' [-Wimplicit-function-declaration]
   debug_printf(log_buffer);
   ^
Src/main.c:111:3: warning: implicit declaration of function 'calibrate_ADC2' [-Wimplicit-function-declaration]
   calibrate_ADC2();
   ^
Src/main.c:112:3: warning: implicit declaration of function 'start_ADC2' [-Wimplicit-function-declaration]
   start_ADC2();
   ^
/usr/bin/arm-none-eabi-gcc -c -mcpu=cortex-m4 -mthumb -mfpu=fpv4-sp-d16 -mfloat-abi=hard -DUSE_HAL_DRIVER -DSTM32F303xE -IInc -IDrivers/STM32F3xx_HAL_Driver/Inc -IDrivers/STM32F3xx_HAL_Driver/Inc/Legacy -IDrivers/CMSIS/Device/ST/STM32F3xx/Include -IDrivers/CMSIS/Include -Og -Wall -fdata-sections -ffunction-sections -g -gdwarf-2 -MMD -MP -MF"build/stm32f3xx_hal.d" -MT"build/stm32f3xx_hal.d" -std=gnu99 -Wa,-a,-ad,-alms=build/stm32f3xx_hal.lst Drivers/STM32F3xx_HAL_Driver/Src/stm32f3xx_hal.c -o build/stm32f3xx_hal.o
/usr/bin/arm-none-eabi-gcc -c -mcpu=cortex-m4 -mthumb -mfpu=fpv4-sp-d16 -mfloat-abi=hard -DUSE_HAL_DRIVER -DSTM32F303xE -IInc -IDrivers/STM32F3xx_HAL_Driver/Inc -IDrivers/STM32F3xx_HAL_Driver/Inc/Legacy -IDrivers/CMSIS/Device/ST/STM32F3xx/Include -IDrivers/CMSIS/Include -Og -Wall -fdata-sections -ffunction-sections -g -gdwarf-2 -MMD -MP -MF"build/stm32f3xx_hal_pwr_ex.d" -MT"build/stm32f3xx_hal_pwr_ex.d" -std=gnu99 -Wa,-a,-ad,-alms=build/stm32f3xx_hal_pwr_ex.lst Drivers/STM32F3xx_HAL_Driver/Src/stm32f3xx_hal_pwr_ex.c -o build/stm32f3xx_hal_pwr_ex.o
/usr/bin/arm-none-eabi-gcc -c -mcpu=cortex-m4 -mthumb -mfpu=fpv4-sp-d16 -mfloat-abi=hard -DUSE_HAL_DRIVER -DSTM32F303xE -IInc -IDrivers/STM32F3xx_HAL_Driver/Inc -IDrivers/STM32F3xx_HAL_Driver/Inc/Legacy -IDrivers/CMSIS/Device/ST/STM32F3xx/Include -IDrivers/CMSIS/Include -Og -Wall -fdata-sections -ffunction-sections -g -gdwarf-2 -MMD -MP -MF"build/stm32f3xx_hal_i2c_ex.d" -MT"build/stm32f3xx_hal_i2c_ex.d" -std=gnu99 -Wa,-a,-ad,-alms=build/stm32f3xx_hal_i2c_ex.lst Drivers/STM32F3xx_HAL_Driver/Src/stm32f3xx_hal_i2c_ex.c -o build/stm32f3xx_hal_i2c_ex.o
/usr/bin/arm-none-eabi-gcc -c -mcpu=cortex-m4 -mthumb -mfpu=fpv4-sp-d16 -mfloat-abi=hard -DUSE_HAL_DRIVER -DSTM32F303xE -IInc -IDrivers/STM32F3xx_HAL_Driver/Inc -IDrivers/STM32F3xx_HAL_Driver/Inc/Legacy -IDrivers/CMSIS/Device/ST/STM32F3xx/Include -IDrivers/CMSIS/Include -Og -Wall -fdata-sections -ffunction-sections -g -gdwarf-2 -MMD -MP -MF"build/stm32f3xx_hal_cortex.d" -MT"build/stm32f3xx_hal_cortex.d" -std=gnu99 -Wa,-a,-ad,-alms=build/stm32f3xx_hal_cortex.lst Drivers/STM32F3xx_HAL_Driver/Src/stm32f3xx_hal_cortex.c -o build/stm32f3xx_hal_cortex.o
/usr/bin/arm-none-eabi-gcc -c -mcpu=cortex-m4 -mthumb -mfpu=fpv4-sp-d16 -mfloat-abi=hard -DUSE_HAL_DRIVER -DSTM32F303xE -IInc -IDrivers/STM32F3xx_HAL_Driver/Inc -IDrivers/STM32F3xx_HAL_Driver/Inc/Legacy -IDrivers/CMSIS/Device/ST/STM32F3xx/Include -IDrivers/CMSIS/Include -Og -Wall -fdata-sections -ffunction-sections -g -gdwarf-2 -MMD -MP -MF"build/stm32f3xx_hal_msp.d" -MT"build/stm32f3xx_hal_msp.d" -std=gnu99 -Wa,-a,-ad,-alms=build/stm32f3xx_hal_msp.lst Src/stm32f3xx_hal_msp.c -o build/stm32f3xx_hal_msp.o
/usr/bin/arm-none-eabi-gcc -c -mcpu=cortex-m4 -mthumb -mfpu=fpv4-sp-d16 -mfloat-abi=hard -DUSE_HAL_DRIVER -DSTM32F303xE -IInc -IDrivers/STM32F3xx_HAL_Driver/Inc -IDrivers/STM32F3xx_HAL_Driver/Inc/Legacy -IDrivers/CMSIS/Device/ST/STM32F3xx/Include -IDrivers/CMSIS/Include -Og -Wall -fdata-sections -ffunction-sections -g -gdwarf-2 -MMD -MP -MF"build/stm32f3xx_hal_pwr.d" -MT"build/stm32f3xx_hal_pwr.d" -std=gnu99 -Wa,-a,-ad,-alms=build/stm32f3xx_hal_pwr.lst Drivers/STM32F3xx_HAL_Driver/Src/stm32f3xx_hal_pwr.c -o build/stm32f3xx_hal_pwr.o
/usr/bin/arm-none-eabi-gcc -c -mcpu=cortex-m4 -mthumb -mfpu=fpv4-sp-d16 -mfloat-abi=hard -DUSE_HAL_DRIVER -DSTM32F303xE -IInc -IDrivers/STM32F3xx_HAL_Driver/Inc -IDrivers/STM32F3xx_HAL_Driver/Inc/Legacy -IDrivers/CMSIS/Device/ST/STM32F3xx/Include -IDrivers/CMSIS/Include -Og -Wall -fdata-sections -ffunction-sections -g -gdwarf-2 -MMD -MP -MF"build/stm32f3xx_hal_flash.d" -MT"build/stm32f3xx_hal_flash.d" -std=gnu99 -Wa,-a,-ad,-alms=build/stm32f3xx_hal_flash.lst Drivers/STM32F3xx_HAL_Driver/Src/stm32f3xx_hal_flash.c -o build/stm32f3xx_hal_flash.o
/usr/bin/arm-none-eabi-gcc -c -mcpu=cortex-m4 -mthumb -mfpu=fpv4-sp-d16 -mfloat-abi=hard -DUSE_HAL_DRIVER -DSTM32F303xE -IInc -IDrivers/STM32F3xx_HAL_Driver/Inc -IDrivers/STM32F3xx_HAL_Driver/Inc/Legacy -IDrivers/CMSIS/Device/ST/STM32F3xx/Include -IDrivers/CMSIS/Include -Og -Wall -fdata-sections -ffunction-sections -g -gdwarf-2 -MMD -MP -MF"build/stm32f3xx_hal_tim.d" -MT"build/stm32f3xx_hal_tim.d" -std=gnu99 -Wa,-a,-ad,-alms=build/stm32f3xx_hal_tim.lst Drivers/STM32F3xx_HAL_Driver/Src/stm32f3xx_hal_tim.c -o build/stm32f3xx_hal_tim.o
/usr/bin/arm-none-eabi-gcc -c -mcpu=cortex-m4 -mthumb -mfpu=fpv4-sp-d16 -mfloat-abi=hard -DUSE_HAL_DRIVER -DSTM32F303xE -IInc -IDrivers/STM32F3xx_HAL_Driver/Inc -IDrivers/STM32F3xx_HAL_Driver/Inc/Legacy -IDrivers/CMSIS/Device/ST/STM32F3xx/Include -IDrivers/CMSIS/Include -Og -Wall -fdata-sections -ffunction-sections -g -gdwarf-2 -MMD -MP -MF"build/stm32f3xx_it.d" -MT"build/stm32f3xx_it.d" -std=gnu99 -Wa,-a,-ad,-alms=build/stm32f3xx_it.lst Src/stm32f3xx_it.c -o build/stm32f3xx_it.o
/usr/bin/arm-none-eabi-gcc -c -mcpu=cortex-m4 -mthumb -mfpu=fpv4-sp-d16 -mfloat-abi=hard -DUSE_HAL_DRIVER -DSTM32F303xE -IInc -IDrivers/STM32F3xx_HAL_Driver/Inc -IDrivers/STM32F3xx_HAL_Driver/Inc/Legacy -IDrivers/CMSIS/Device/ST/STM32F3xx/Include -IDrivers/CMSIS/Include -Og -Wall -fdata-sections -ffunction-sections -g -gdwarf-2 -MMD -MP -MF"build/stm32f3xx_hal_flash_ex.d" -MT"build/stm32f3xx_hal_flash_ex.d" -std=gnu99 -Wa,-a,-ad,-alms=build/stm32f3xx_hal_flash_ex.lst Drivers/STM32F3xx_HAL_Driver/Src/stm32f3xx_hal_flash_ex.c -o build/stm32f3xx_hal_flash_ex.o
/usr/bin/arm-none-eabi-gcc -c -mcpu=cortex-m4 -mthumb -mfpu=fpv4-sp-d16 -mfloat-abi=hard -DUSE_HAL_DRIVER -DSTM32F303xE -IInc -IDrivers/STM32F3xx_HAL_Driver/Inc -IDrivers/STM32F3xx_HAL_Driver/Inc/Legacy -IDrivers/CMSIS/Device/ST/STM32F3xx/Include -IDrivers/CMSIS/Include -Og -Wall -fdata-sections -ffunction-sections -g -gdwarf-2 -MMD -MP -MF"build/stm32f3xx_hal_uart_ex.d" -MT"build/stm32f3xx_hal_uart_ex.d" -std=gnu99 -Wa,-a,-ad,-alms=build/stm32f3xx_hal_uart_ex.lst Drivers/STM32F3xx_HAL_Driver/Src/stm32f3xx_hal_uart_ex.c -o build/stm32f3xx_hal_uart_ex.o
/usr/bin/arm-none-eabi-gcc -c -mcpu=cortex-m4 -mthumb -mfpu=fpv4-sp-d16 -mfloat-abi=hard -DUSE_HAL_DRIVER -DSTM32F303xE -IInc -IDrivers/STM32F3xx_HAL_Driver/Inc -IDrivers/STM32F3xx_HAL_Driver/Inc/Legacy -IDrivers/CMSIS/Device/ST/STM32F3xx/Include -IDrivers/CMSIS/Include -Og -Wall -fdata-sections -ffunction-sections -g -gdwarf-2 -MMD -MP -MF"build/stm32f3xx_hal_dma.d" -MT"build/stm32f3xx_hal_dma.d" -std=gnu99 -Wa,-a,-ad,-alms=build/stm32f3xx_hal_dma.lst Drivers/STM32F3xx_HAL_Driver/Src/stm32f3xx_hal_dma.c -o build/stm32f3xx_hal_dma.o
/usr/bin/arm-none-eabi-gcc -c -mcpu=cortex-m4 -mthumb -mfpu=fpv4-sp-d16 -mfloat-abi=hard -DUSE_HAL_DRIVER -DSTM32F303xE -IInc -IDrivers/STM32F3xx_HAL_Driver/Inc -IDrivers/STM32F3xx_HAL_Driver/Inc/Legacy -IDrivers/CMSIS/Device/ST/STM32F3xx/Include -IDrivers/CMSIS/Include -Og -Wall -fdata-sections -ffunction-sections -g -gdwarf-2 -MMD -MP -MF"build/stm32f3xx_hal_rcc.d" -MT"build/stm32f3xx_hal_rcc.d" -std=gnu99 -Wa,-a,-ad,-alms=build/stm32f3xx_hal_rcc.lst Drivers/STM32F3xx_HAL_Driver/Src/stm32f3xx_hal_rcc.c -o build/stm32f3xx_hal_rcc.o
/usr/bin/arm-none-eabi-gcc -c -mcpu=cortex-m4 -mthumb -mfpu=fpv4-sp-d16 -mfloat-abi=hard -DUSE_HAL_DRIVER -DSTM32F303xE -IInc -IDrivers/STM32F3xx_HAL_Driver/Inc -IDrivers/STM32F3xx_HAL_Driver/Inc/Legacy -IDrivers/CMSIS/Device/ST/STM32F3xx/Include -IDrivers/CMSIS/Include -Og -Wall -fdata-sections -ffunction-sections -g -gdwarf-2 -MMD -MP -MF"build/stm32f3xx_hal_rcc_ex.d" -MT"build/stm32f3xx_hal_rcc_ex.d" -std=gnu99 -Wa,-a,-ad,-alms=build/stm32f3xx_hal_rcc_ex.lst Drivers/STM32F3xx_HAL_Driver/Src/stm32f3xx_hal_rcc_ex.c -o build/stm32f3xx_hal_rcc_ex.o
/usr/bin/arm-none-eabi-gcc -c -mcpu=cortex-m4 -mthumb -mfpu=fpv4-sp-d16 -mfloat-abi=hard -DUSE_HAL_DRIVER -DSTM32F303xE -IInc -IDrivers/STM32F3xx_HAL_Driver/Inc -IDrivers/STM32F3xx_HAL_Driver/Inc/Legacy -IDrivers/CMSIS/Device/ST/STM32F3xx/Include -IDrivers/CMSIS/Include -Og -Wall -fdata-sections -ffunction-sections -g -gdwarf-2 -MMD -MP -MF"build/stm32f3xx_hal_gpio.d" -MT"build/stm32f3xx_hal_gpio.d" -std=gnu99 -Wa,-a,-ad,-alms=build/stm32f3xx_hal_gpio.lst Drivers/STM32F3xx_HAL_Driver/Src/stm32f3xx_hal_gpio.c -o build/stm32f3xx_hal_gpio.o
/usr/bin/arm-none-eabi-gcc -c -mcpu=cortex-m4 -mthumb -mfpu=fpv4-sp-d16 -mfloat-abi=hard -DUSE_HAL_DRIVER -DSTM32F303xE -IInc -IDrivers/STM32F3xx_HAL_Driver/Inc -IDrivers/STM32F3xx_HAL_Driver/Inc/Legacy -IDrivers/CMSIS/Device/ST/STM32F3xx/Include -IDrivers/CMSIS/Include -Og -Wall -fdata-sections -ffunction-sections -g -gdwarf-2 -MMD -MP -MF"build/stm32f3xx_hal_i2c.d" -MT"build/stm32f3xx_hal_i2c.d" -std=gnu99 -Wa,-a,-ad,-alms=build/stm32f3xx_hal_i2c.lst Drivers/STM32F3xx_HAL_Driver/Src/stm32f3xx_hal_i2c.c -o build/stm32f3xx_hal_i2c.o
/usr/bin/arm-none-eabi-gcc -c -mcpu=cortex-m4 -mthumb -mfpu=fpv4-sp-d16 -mfloat-abi=hard -DUSE_HAL_DRIVER -DSTM32F303xE -IInc -IDrivers/STM32F3xx_HAL_Driver/Inc -IDrivers/STM32F3xx_HAL_Driver/Inc/Legacy -IDrivers/CMSIS/Device/ST/STM32F3xx/Include -IDrivers/CMSIS/Include -Og -Wall -fdata-sections -ffunction-sections -g -gdwarf-2 -MMD -MP -MF"build/system_stm32f3xx.d" -MT"build/system_stm32f3xx.d" -std=gnu99 -Wa,-a,-ad,-alms=build/system_stm32f3xx.lst Src/system_stm32f3xx.c -o build/system_stm32f3xx.o
/usr/bin/arm-none-eabi-gcc -c -mcpu=cortex-m4 -mthumb -mfpu=fpv4-sp-d16 -mfloat-abi=hard -DUSE_HAL_DRIVER -DSTM32F303xE -IInc -IDrivers/STM32F3xx_HAL_Driver/Inc -IDrivers/STM32F3xx_HAL_Driver/Inc/Legacy -IDrivers/CMSIS/Device/ST/STM32F3xx/Include -IDrivers/CMSIS/Include -Og -Wall -fdata-sections -ffunction-sections -g -gdwarf-2 -MMD -MP -MF"build/stm32f3xx_hal_tim_ex.d" -MT"build/stm32f3xx_hal_tim_ex.d" -std=gnu99 -Wa,-a,-ad,-alms=build/stm32f3xx_hal_tim_ex.lst Drivers/STM32F3xx_HAL_Driver/Src/stm32f3xx_hal_tim_ex.c -o build/stm32f3xx_hal_tim_ex.o
/usr/bin/arm-none-eabi-gcc -c -mcpu=cortex-m4 -mthumb -mfpu=fpv4-sp-d16 -mfloat-abi=hard -DUSE_HAL_DRIVER -DSTM32F303xE -IInc -IDrivers/STM32F3xx_HAL_Driver/Inc -IDrivers/STM32F3xx_HAL_Driver/Inc/Legacy -IDrivers/CMSIS/Device/ST/STM32F3xx/Include -IDrivers/CMSIS/Include -Og -Wall -fdata-sections -ffunction-sections -g -gdwarf-2 -MMD -MP -MF"build/usart.d" -MT"build/usart.d" -std=gnu99 -Wa,-a,-ad,-alms=build/usart.lst Src/usart.c -o build/usart.o
Src/usart.c: In function 'debug_printf':
Src/usart.c:128:43: warning: implicit declaration of function 'strlen' [-Wimplicit-function-declaration]
   HAL_UART_Transmit(&huart2, (uint8_t*)p, strlen(p), 1000);
                                           ^
Src/usart.c:128:43: warning: incompatible implicit declaration of built-in function 'strlen'
Src/usart.c:128:43: note: include '<string.h>' or provide a declaration of 'strlen'
/usr/bin/arm-none-eabi-gcc -c -mcpu=cortex-m4 -mthumb -mfpu=fpv4-sp-d16 -mfloat-abi=hard -DUSE_HAL_DRIVER -DSTM32F303xE -IInc -IDrivers/STM32F3xx_HAL_Driver/Inc -IDrivers/STM32F3xx_HAL_Driver/Inc/Legacy -IDrivers/CMSIS/Device/ST/STM32F3xx/Include -IDrivers/CMSIS/Include -Og -Wall -fdata-sections -ffunction-sections -g -gdwarf-2 -MMD -MP -MF"build/gpio.d" -MT"build/gpio.d" -std=gnu99 -Wa,-a,-ad,-alms=build/gpio.lst Src/gpio.c -o build/gpio.o
/usr/bin/arm-none-eabi-gcc -c -mcpu=cortex-m4 -mthumb -mfpu=fpv4-sp-d16 -mfloat-abi=hard -DUSE_HAL_DRIVER -DSTM32F303xE -IInc -IDrivers/STM32F3xx_HAL_Driver/Inc -IDrivers/STM32F3xx_HAL_Driver/Inc/Legacy -IDrivers/CMSIS/Device/ST/STM32F3xx/Include -IDrivers/CMSIS/Include -Og -Wall -fdata-sections -ffunction-sections -g -gdwarf-2 -MMD -MP -MF"build/stm32f3xx_hal_adc.d" -MT"build/stm32f3xx_hal_adc.d" -std=gnu99 -Wa,-a,-ad,-alms=build/stm32f3xx_hal_adc.lst Drivers/STM32F3xx_HAL_Driver/Src/stm32f3xx_hal_adc.c -o build/stm32f3xx_hal_adc.o
/usr/bin/arm-none-eabi-gcc -c -mcpu=cortex-m4 -mthumb -mfpu=fpv4-sp-d16 -mfloat-abi=hard -DUSE_HAL_DRIVER -DSTM32F303xE -IInc -IDrivers/STM32F3xx_HAL_Driver/Inc -IDrivers/STM32F3xx_HAL_Driver/Inc/Legacy -IDrivers/CMSIS/Device/ST/STM32F3xx/Include -IDrivers/CMSIS/Include -Og -Wall -fdata-sections -ffunction-sections -g -gdwarf-2 -MMD -MP -MF"build/stm32f3xx_hal_adc_ex.d" -MT"build/stm32f3xx_hal_adc_ex.d" -std=gnu99 -Wa,-a,-ad,-alms=build/stm32f3xx_hal_adc_ex.lst Drivers/STM32F3xx_HAL_Driver/Src/stm32f3xx_hal_adc_ex.c -o build/stm32f3xx_hal_adc_ex.o
/usr/bin/arm-none-eabi-gcc -c -mcpu=cortex-m4 -mthumb -mfpu=fpv4-sp-d16 -mfloat-abi=hard -DUSE_HAL_DRIVER -DSTM32F303xE -IInc -IDrivers/STM32F3xx_HAL_Driver/Inc -IDrivers/STM32F3xx_HAL_Driver/Inc/Legacy -IDrivers/CMSIS/Device/ST/STM32F3xx/Include -IDrivers/CMSIS/Include -Og -Wall -fdata-sections -ffunction-sections -g -gdwarf-2 -MMD -MP -MF"build/adc.d" -MT"build/adc.d" -std=gnu99 -Wa,-a,-ad,-alms=build/adc.lst Src/adc.c -o build/adc.o
/usr/bin/arm-none-eabi-gcc -c -mcpu=cortex-m4 -mthumb -mfpu=fpv4-sp-d16 -mfloat-abi=hard -DUSE_HAL_DRIVER -DSTM32F303xE -IInc -IDrivers/STM32F3xx_HAL_Driver/Inc -IDrivers/STM32F3xx_HAL_Driver/Inc/Legacy -IDrivers/CMSIS/Device/ST/STM32F3xx/Include -IDrivers/CMSIS/Include -Og -Wall -fdata-sections -ffunction-sections -g -gdwarf-2 -MMD -MP -MF"build/dma.d" -MT"build/dma.d" -std=gnu99 -Wa,-a,-ad,-alms=build/dma.lst Src/dma.c -o build/dma.o
/usr/bin/arm-none-eabi-gcc -x assembler-with-cpp -c -mcpu=cortex-m4 -mthumb -mfpu=fpv4-sp-d16 -mfloat-abi=hard -DUSE_HAL_DRIVER -DSTM32F303xE -IInc -IDrivers/STM32F3xx_HAL_Driver/Inc -IDrivers/STM32F3xx_HAL_Driver/Inc/Legacy -IDrivers/CMSIS/Device/ST/STM32F3xx/Include -IDrivers/CMSIS/Include -Og -Wall -fdata-sections -ffunction-sections -g -gdwarf-2 -MMD -MP -MF"build/startup_stm32f303xe.d" -MT"build/startup_stm32f303xe.d" -std=gnu99 startup_stm32f303xe.s -o build/startup_stm32f303xe.o
/usr/bin/arm-none-eabi-gcc build/stm32f3xx_hal_uart.o build/main.o build/stm32f3xx_hal.o build/stm32f3xx_hal_pwr_ex.o build/stm32f3xx_hal_i2c_ex.o build/stm32f3xx_hal_cortex.o build/stm32f3xx_hal_msp.o build/stm32f3xx_hal_pwr.o build/stm32f3xx_hal_flash.o build/stm32f3xx_hal_tim.o build/stm32f3xx_it.o build/stm32f3xx_hal_flash_ex.o build/stm32f3xx_hal_uart_ex.o build/stm32f3xx_hal_dma.o build/stm32f3xx_hal_rcc.o build/stm32f3xx_hal_rcc_ex.o build/stm32f3xx_hal_gpio.o build/stm32f3xx_hal_i2c.o build/system_stm32f3xx.o build/stm32f3xx_hal_tim_ex.o build/usart.o build/gpio.o build/stm32f3xx_hal_adc.o build/stm32f3xx_hal_adc_ex.o build/adc.o build/dma.o build/startup_stm32f303xe.o -mcpu=cortex-m4 -mthumb -mfpu=fpv4-sp-d16 -mfloat-abi=hard -specs=nano.specs -TSTM32F303RETx_FLASH.ld -lc -lm -lnosys -Wl,-Map=build/stm32test1.map,--cref -Wl,--gc-sections -Xlinker --no-wchar-size-warning -o build/stm32test1.elf
/usr/bin/arm-none-eabi-size build/stm32test1.elf
   text data bss dec hex filename
  11256 12 4948 16216 3f58 build/stm32test1.elf
/usr/bin/arm-none-eabi-objcopy -O ihex build/stm32test1.elf build/stm32test1.hex
/usr/bin/arm-none-eabi-objcopy -O binary -S build/stm32test1.elf build/stm32test1.bin
pi@raspberrypi:~/stm32tests/stm32test1 $

```

here’s what Robert is compiling  
[stm32tests-master.zip](https://community.openenergymonitor.org/uploads/default/original/2X/7/7551f87c32713f7a93c9e951159e388db270a2be.zip) (653.8 KB)

I do not get those errors with the emonTxshield\_2 andemonTxshield\_3 I haven’t tried \_4 yet and \_1 doesn’t compile.

---

<div class="post-metadata">

**Author:** ![TrystanLea](https://community.openenergymonitor.org/user_avatar/community.openenergymonitor.org/trystanlea/32/31_2.png) [@TrystanLea](https://community.openenergymonitor.org/u/TrystanLea)\
**Post date:** [25 March 2018 09:58 UTC](https://community.openenergymonitor.org/t/stm32-development/6815/75 "2018-03-25T09:58:33Z")

</div>

Since I was missing a jumper to connect PA0 to PB14 and to help my learning process I’ve decided to build on the end of your _3. ADC Tutorial Part3, adding user code to make it useful._ tutorial @dBC adding in some RMS voltage and current maths to see if I could get my head around it. I’ve stuck to 1 ADC and inputs A0 (Voltage) and A1 (CT1) for now and am getting good results 🙂

![rmscalc](https://community.openenergymonitor.org/uploads/default/original/2X/5/57907472458a67cc385bef53bd9e7df8ddfbc971.png)

These are the modifications I made from my last point showing the rms math [https://github.com/TrystanLea/STM32Dev/commit/3b37aa5acdb2169fa835b9a8d956fd1a29f35221](https://github.com/TrystanLea/STM32Dev/commit/3b37aa5acdb2169fa835b9a8d956fd1a29f35221)

Im using the shiftedFCL filter documented by @Robert.Wall in learn [Learn | OpenEnergyMonitor](https://learn.openenergymonitor.org/electricity-monitoring/ctac/digital-filters-for-offset-removal) and Im not doing any zero crossing detection to start/end the sampling period yet.

---

<div class="post-metadata">

**Author:** ![TrystanLea](https://community.openenergymonitor.org/user_avatar/community.openenergymonitor.org/trystanlea/32/31_2.png) [@TrystanLea](https://community.openenergymonitor.org/u/TrystanLea)\
**Post date:** [25 March 2018 10:15 UTC](https://community.openenergymonitor.org/t/stm32-development/6815/76 "2018-03-25T10:15:26Z")

</div>

Now with a calculation of real power 🙂  
[https://github.com/TrystanLea/STM32Dev/blob/master/STM02/Src/main.c](https://github.com/TrystanLea/STM32Dev/blob/master/STM02/Src/main.c)

---

<div class="post-metadata">

**Author:** ![dBC](https://community.openenergymonitor.org/letter_avatar_proxy/v4/letter/d/5f9b8f/32.png) [@dBC](https://community.openenergymonitor.org/u/dBC)\
**Post date:** [25 March 2018 10:28 UTC](https://community.openenergymonitor.org/t/stm32-development/6815/77 "2018-03-25T10:28:44Z")

</div>

Cool. And to answer your question in the comment…

```
`ADC1_DMA_BUFFSIZE 4000 // must me integer multiple of number of channels?`

```

The practical answer is yes, it must be a multiple. If it’s not the DMA controller will still jump back to the beginning of the buffer when it gets to the end (so there’ll be no overrun into what lives past the buffer) but it will do that part way through the sequence. Once that happens, you’ll lose track of which channel buff[0] represents as it’ll change each time around.

On the multiple ADC front, I’ve made some progress on how to support negative (and 0) delays… currently the delays only go in one direction (Current ADCs start early, Voltage ADC starts late). Not quite there yet though, and then there’ll be a lot of scope testing to make sure they’re all kicking off on the correct edges.

---

<div class="post-metadata">

**Author:** ![TrystanLea](https://community.openenergymonitor.org/user_avatar/community.openenergymonitor.org/trystanlea/32/31_2.png) [@TrystanLea](https://community.openenergymonitor.org/u/TrystanLea)\
**Post date:** [25 March 2018 11:07 UTC](https://community.openenergymonitor.org/t/stm32-development/6815/78 "2018-03-25T11:07:06Z")

</div>

Thanks @dBC, that sounds great, looking forward to hearing more about how it develops.

I’ve now amended my test code to print out, Vrms, Irms, realPower, apparentPower and powerFactor as floats with the makefile modifications you mentioned.

```
BINPATH = /usr/bin
CFLAGS += -std=gnu99
LDFLAGS += -Xlinker --no-wchar-size-warning -u _printf_float
```

---

<div class="post-metadata">

**Author:** ![Robert.Wall](https://community.openenergymonitor.org/user_avatar/community.openenergymonitor.org/robert.wall/32/38246_2.png) [@Robert.Wall](https://community.openenergymonitor.org/u/Robert.Wall)\
**Post date:** [25 March 2018 12:13 UTC](https://community.openenergymonitor.org/t/stm32-development/6815/79 "2018-03-25T12:13:59Z")

</div>

> [@TrystanLea](#):
>
> Im using the shiftedFCL filter documented by @Robert.Wall in learn [Digital filters for offset removal — OpenEnergyMonitor 0.0.1 documentation](https://learn.openenergymonitor.org/electricity-monitoring/ctac/digital-filters-for-offset-removal)

A much better way, as long as the bias/offset is stable, is like emonLibCM: remove the offset at the reporting stage. (Not that you’re worried about speeding up the calculation - but it does!)

---

<div class="post-metadata">

**Author:** ![dBC](https://community.openenergymonitor.org/letter_avatar_proxy/v4/letter/d/5f9b8f/32.png) [@dBC](https://community.openenergymonitor.org/u/dBC)\
**Post date:** [25 March 2018 19:47 UTC](https://community.openenergymonitor.org/t/stm32-development/6815/80 "2018-03-25T19:47:35Z")

</div>

Yes, I followed your lead on that in power.c and I agree it’s much better.

---

<div class="post-metadata">

**Author:** ![dBC](https://community.openenergymonitor.org/letter_avatar_proxy/v4/letter/d/5f9b8f/32.png) [@dBC](https://community.openenergymonitor.org/u/dBC)\
**Post date:** [25 March 2018 21:20 UTC](https://community.openenergymonitor.org/t/stm32-development/6815/81 "2018-03-25T21:20:06Z")

</div>

I’ve been thinking a bit about how to best approach 3 phase. ADC1 and ADC2 can each reach 7 input pins, while ADC3 and ADC4 can each reach 3 pins, so it might make sense to permanently devote ADC4 to Voltage measurements and let it continuously cycle through the 3 voltage measurements. That leaves 17 Current inputs spread across the other three.

Using the sequencer slots, I think we could have a lot of flexibility on assigning a Current input to a phase, i.e. it could be done at runtime (or config time) rather than hardwired at the factory. The simplest case is where the phases happen to end up well distributed across the 3 Current ADCs like this:  
 ![easy](https://community.openenergymonitor.org/uploads/default/original/2X/8/8d8c9ffebe5f1666ab40722a18daaa5cc48c74e6.png)  
In this diagram, C2.6 for example means channel 6 on ADC2, phase is indicated by colour. So you can choose C2.6’s phase simply by which slot you drop it into. When they’re well dispersed like in the above example it’s easy because there are slots to spare.

The more challenging case is where all the Red phase CTs happen to end up on ADC1, all the Yellow on ADC2 and all the Blue on ADC3. In that case we run out of slots and compromises have to be made:  
 ![congestion](https://community.openenergymonitor.org/uploads/default/original/2X/e/e80bf883a6644a7d445093a8cbbdb1c61b32e84f.png)  
We had to move one of the Reds to ADC2 and one of the Yellows to ADC1 and one of the Blues to ADC2. So it doesn’t give total flexibility, but apart from a few pathological cases, it comes pretty close.

---

<div class="post-metadata">

**Author:** ![pb66](https://community.openenergymonitor.org/user_avatar/community.openenergymonitor.org/pb66/32/27_2.png) [@pb66](https://community.openenergymonitor.org/u/pb66)\
**Post date:** [25 March 2018 21:36 UTC](https://community.openenergymonitor.org/t/stm32-development/6815/82 "2018-03-25T21:36:59Z")

</div>

I wonder if the 64 pin package is making things too awkward, the 144pin package would offer 40 adc channels to pick from. We don’t need to break them all out for to use the full 40 all at once, but it might give us the flexibility to have a wider variety of profiles, some physical inputs could be hardwired or jumpered to multiple adc’s.

There was also a question about using the F373 which has only 2 ADC’s (16bit) and 40 channels, as that might fit better with with what we’re doing. I haven’t looked at the F373 spec closely, but as long as there are at least 3 adc12 channels for the Vac, the configuration will be pretty easy as any CT channel can then be associated with any Vac channel.

If there’s not much in the pricing 64p v 144p or F303 v F373, we maybe making hard work for ourselves unnecessarily.

[Previous page](https://community.openenergymonitor.org/t/stm32-development/6815.md?page=3)

[Next page](https://community.openenergymonitor.org/t/stm32-development/6815.md?page=5)
