Sensor Expansion Board source code help

Hi all, My name is Danny Ive been reading these forums for a little bit of time but this is my first post so I hope you guys dont mind as its asking for help right away…
I have the pixelblaze and the sensor expansion board. I would like to play around with the code that is running the sensor expansion board but I cant workout how to recompile the code. I’m not a great programmer. I see there in a ‘.project’ file in the folder but I have no idea what program to load that into ? I’m running windows and have a feeling its a compiler for linux which is no good for me :frowning: has anyone a working project file for a windows compiler that they could give me to get me started ? I’m using the sensor board with a Teensy 4.1 board to control a laser so my goal is to change the 5 analogue inputs too digital outs as I just don’t need the inputs, I would love to just play around with the code as I really like the way the code responds to music and I know I would learn a lot from being able to poke around inside…
any help would be great…

Hi Danny!
You’ll need stm32 cube ide, from st microelectronics. It’s free and runs on any platform.

You’ll also need a SWD programmer. St-link is one product that does this. There are also cheap st link clones that work.

You can also get a segger j link that works with more chips, the edu version isn’t too expensive.

1 Like

Thank you for the reply, I have tried to open the project file up in stm32 cube ide but it didn’t seem to work but to be fair I really don’t know the program that well so I expect I’m doing something wrong so I will have another look at it. thanks again

Still not having any luck with this , I load the project file and hit compile but all I get is two warnings
Unknown referenced nature: fr.ac6.mcu.ide.core.MCUSingleCoreProjectNature.|.project|/sensorsRaw|Unknown|Unknown nature|

but no build ?
Should I be able to just load up the .project file and compile or is there something else I have to do…

I’m using STM32CubeIDE Version: 1.9.0 Build: 12015_20220302_0855 (UTC)
I have ST link programmer that I’ve tested with a simple blink program.

I know this isn’t really a Pixalblaze problem and is more my lack of programming knowledge so I understand if I’m asking to much here and if that’s the case pelase forgive me :slight_smile:

Try importing the project. I’d that fails, use the .ioc file to start a new project, then replace the source code files of the generated project with the ones from from the repo.

ok I will try that thanks :slight_smile:

Well i’ve been trying with this but having no luck, Wizard if you have a few minuities could you load the cube project up and test it to make sure the download is a valid project ?
there is no .IOC file in the download ?

Ah, it was a bit older than I had remembered. This was created using the STM32 Cube IDE predecessor, AC6.

Try importing the project using this option:

Doing that the import worked and I can recompile.

If that fails, you could spin up a new STM32 project for the same chip (STM32F030F4P6), and swap out the source files. The linker file name changed, and it was customized to set heap to 0, stack to 0x400.

1 Like

Thank you I will give that a go and sorry for the late reply I been away for a few days :slight_smile:

Well Mr wizard with your help I have made a little more progress, Just importing the files failed to work, I hit build and nothing at all happened so as you suggested I made a new project and swapped out all the source files, but I was getting errors regarding the I2C functions ? it seems the files in the StdPeriph_Driver folder were not being loaded so I added USE_STDPERIPH_DRIVER to the definition list but then I just more errors so now I’m a bit lost as to what to do now ? can you spot anything that I’ve done wrong ?

14:21:54 **** Incremental Build of configuration Debug for project SensorsRaw_01 ****
make -j4 all 
arm-none-eabi-gcc "../Src/fix_fft.c" -mcpu=cortex-m0 -std=gnu11 -g3 -DDEBUG -DUSE_STDPERIPH_DRIVER -DSTM32 -DSTM32F0 -DSTM32F030F4Px -c -I../Inc -I"C:/ST/Projects/FFT3/StdPeriph_Driver/inc" -I"C:/ST/Projects/FFT3/StdPeriph_Driver/src" -I"C:/ST/Projects/FFT3/CMSIS/core" -I"C:/ST/Projects/FFT3/CMSIS/device" -O0 -ffunction-sections -fdata-sections -Wall -fstack-usage -MMD -MP -MF"Src/fix_fft.d" -MT"Src/fix_fft.o" --specs=nano.specs -mfloat-abi=soft -mthumb -o "Src/fix_fft.o"
arm-none-eabi-gcc "../Src/libfixmath_sqrt.c" -mcpu=cortex-m0 -std=gnu11 -g3 -DDEBUG -DUSE_STDPERIPH_DRIVER -DSTM32 -DSTM32F0 -DSTM32F030F4Px -c -I../Inc -I"C:/ST/Projects/FFT3/StdPeriph_Driver/inc" -I"C:/ST/Projects/FFT3/StdPeriph_Driver/src" -I"C:/ST/Projects/FFT3/CMSIS/core" -I"C:/ST/Projects/FFT3/CMSIS/device" -O0 -ffunction-sections -fdata-sections -Wall -fstack-usage -MMD -MP -MF"Src/libfixmath_sqrt.d" -MT"Src/libfixmath_sqrt.o" --specs=nano.specs -mfloat-abi=soft -mthumb -o "Src/libfixmath_sqrt.o"
arm-none-eabi-gcc "../Src/main.c" -mcpu=cortex-m0 -std=gnu11 -g3 -DDEBUG -DUSE_STDPERIPH_DRIVER -DSTM32 -DSTM32F0 -DSTM32F030F4Px -c -I../Inc -I"C:/ST/Projects/FFT3/StdPeriph_Driver/inc" -I"C:/ST/Projects/FFT3/StdPeriph_Driver/src" -I"C:/ST/Projects/FFT3/CMSIS/core" -I"C:/ST/Projects/FFT3/CMSIS/device" -O0 -ffunction-sections -fdata-sections -Wall -fstack-usage -MMD -MP -MF"Src/main.d" -MT"Src/main.o" --specs=nano.specs -mfloat-abi=soft -mthumb -o "Src/main.o"
arm-none-eabi-gcc "../Src/output.c" -mcpu=cortex-m0 -std=gnu11 -g3 -DDEBUG -DUSE_STDPERIPH_DRIVER -DSTM32 -DSTM32F0 -DSTM32F030F4Px -c -I../Inc -I"C:/ST/Projects/FFT3/StdPeriph_Driver/inc" -I"C:/ST/Projects/FFT3/StdPeriph_Driver/src" -I"C:/ST/Projects/FFT3/CMSIS/core" -I"C:/ST/Projects/FFT3/CMSIS/device" -O0 -ffunction-sections -fdata-sections -Wall -fstack-usage -MMD -MP -MF"Src/output.d" -MT"Src/output.o" --specs=nano.specs -mfloat-abi=soft -mthumb -o "Src/output.o"
arm-none-eabi-gcc "../Src/syscalls.c" -mcpu=cortex-m0 -std=gnu11 -g3 -DDEBUG -DUSE_STDPERIPH_DRIVER -DSTM32 -DSTM32F0 -DSTM32F030F4Px -c -I../Inc -I"C:/ST/Projects/FFT3/StdPeriph_Driver/inc" -I"C:/ST/Projects/FFT3/StdPeriph_Driver/src" -I"C:/ST/Projects/FFT3/CMSIS/core" -I"C:/ST/Projects/FFT3/CMSIS/device" -O0 -ffunction-sections -fdata-sections -Wall -fstack-usage -MMD -MP -MF"Src/syscalls.d" -MT"Src/syscalls.o" --specs=nano.specs -mfloat-abi=soft -mthumb -o "Src/syscalls.o"
arm-none-eabi-gcc "../Src/system_stm32f0xx.c" -mcpu=cortex-m0 -std=gnu11 -g3 -DDEBUG -DUSE_STDPERIPH_DRIVER -DSTM32 -DSTM32F0 -DSTM32F030F4Px -c -I../Inc -I"C:/ST/Projects/FFT3/StdPeriph_Driver/inc" -I"C:/ST/Projects/FFT3/StdPeriph_Driver/src" -I"C:/ST/Projects/FFT3/CMSIS/core" -I"C:/ST/Projects/FFT3/CMSIS/device" -O0 -ffunction-sections -fdata-sections -Wall -fstack-usage -MMD -MP -MF"Src/system_stm32f0xx.d" -MT"Src/system_stm32f0xx.o" --specs=nano.specs -mfloat-abi=soft -mthumb -o "Src/system_stm32f0xx.o"
../Src/system_stm32f0xx.c: In function 'SystemInit':
../Src/system_stm32f0xx.c:161:24: warning: suggest parentheses around arithmetic in operand of '|' [-Wparentheses]
  161 |  RCC->CFGR = RCC->CFGR & (~RCC_CFGR_PLLMUL) | (RCC_CFGR_PLLMUL12);
arm-none-eabi-gcc -o "SensorsRaw_01.elf" @"objects.list"   -mcpu=cortex-m0 -T"C:\ST\Projects\FFT3\STM32F030F4PX_FLASH.ld" --specs=nosys.specs -Wl,-Map="SensorsRaw_01.map" -Wl,--gc-sections -static --specs=nano.specs -mfloat-abi=soft -mthumb -Wl,--start-group -lc -lm -Wl,--end-group
c:\st\stm32cubeide_1.9.0\stm32cubeide\plugins\com.st.stm32cube.ide.mcu.externaltools.gnu-tools-for-stm32.10.3-2021.10.win32_1.0.0.202111181127\tools\arm-none-eabi\bin\ld.exe: ./Src/main.o: in function `i2cWriteReg':
C:/ST/Projects/FFT3/Debug/../Src/main.c:196: undefined reference to `I2C_TransferHandling'
c:\st\stm32cubeide_1.9.0\stm32cubeide\plugins\com.st.stm32cube.ide.mcu.externaltools.gnu-tools-for-stm32.10.3-2021.10.win32_1.0.0.202111181127\tools\arm-none-eabi\bin\ld.exe: C:/ST/Projects/FFT3/Debug/../Src/main.c:198: undefined reference to `I2C_GetFlagStatus'
c:\st\stm32cubeide_1.9.0\stm32cubeide\plugins\com.st.stm32cube.ide.mcu.externaltools.gnu-tools-for-stm32.10.3-2021.10.win32_1.0.0.202111181127\tools\arm-none-eabi\bin\ld.exe: C:/ST/Projects/FFT3/Debug/../Src/main.c:201: undefined reference to `I2C_SendData'
c:\st\stm32cubeide_1.9.0\stm32cubeide\plugins\com.st.stm32cube.ide.mcu.externaltools.gnu-tools-for-stm32.10.3-2021.10.win32_1.0.0.202111181127\tools\arm-none-eabi\bin\ld.exe: C:/ST/Projects/FFT3/Debug/../Src/main.c:202: undefined reference to `I2C_GetFlagStatus'
c:\st\stm32cubeide_1.9.0\stm32cubeide\plugins\com.st.stm32cube.ide.mcu.externaltools.gnu-tools-for-stm32.10.3-2021.10.win32_1.0.0.202111181127\tools\arm-none-eabi\bin\ld.exe: C:/ST/Projects/FFT3/Debug/../Src/main.c:204: undefined reference to `I2C_SendData'
c:\st\stm32cubeide_1.9.0\stm32cubeide\plugins\com.st.stm32cube.ide.mcu.externaltools.gnu-tools-for-stm32.10.3-2021.10.win32_1.0.0.202111181127\tools\arm-none-eabi\bin\ld.exe: C:/ST/Projects/FFT3/Debug/../Src/main.c:206: undefined reference to `I2C_GetFlagStatus'
c:\st\stm32cubeide_1.9.0\stm32cubeide\plugins\com.st.stm32cube.ide.mcu.externaltools.gnu-tools-for-stm32.10.3-2021.10.win32_1.0.0.202111181127\tools\arm-none-eabi\bin\ld.exe: C:/ST/Projects/FFT3/Debug/../Src/main.c:208: undefined reference to `I2C_GenerateSTOP'
c:\st\stm32cubeide_1.9.0\stm32cubeide\plugins\com.st.stm32cube.ide.mcu.externaltools.gnu-tools-for-stm32.10.3-2021.10.win32_1.0.0.202111181127\tools\arm-none-eabi\bin\ld.exe: ./Src/main.o: in function `startAccelerometerPoll':
C:/ST/Projects/FFT3/Debug/../Src/main.c:252: undefined reference to `I2C_TransferHandling'
c:\st\stm32cubeide_1.9.0\stm32cubeide\plugins\com.st.stm32cube.ide.mcu.externaltools.gnu-tools-for-stm32.10.3-2021.10.win32_1.0.0.202111181127\tools\arm-none-eabi\bin\ld.exe: ./Src/main.o: in function `I2C1_ErrorHandler':
C:/ST/Projects/FFT3/Debug/../Src/main.c:312: undefined reference to `I2C_GenerateSTOP'
c:\st\stm32cubeide_1.9.0\stm32cubeide\plugins\com.st.stm32cube.ide.mcu.externaltools.gnu-tools-for-stm32.10.3-2021.10.win32_1.0.0.202111181127\tools\arm-none-eabi\bin\ld.exe: ./Src/main.o: in function `I2C1_IRQHandler':
C:/ST/Projects/FFT3/Debug/../Src/main.c:327: undefined reference to `I2C_SendData'
c:\st\stm32cubeide_1.9.0\stm32cubeide\plugins\com.st.stm32cube.ide.mcu.externaltools.gnu-tools-for-stm32.10.3-2021.10.win32_1.0.0.202111181127\tools\arm-none-eabi\bin\ld.exe: C:/ST/Projects/FFT3/Debug/../Src/main.c:339: undefined reference to `I2C_TransferHandling'
collect2.exe: error: ld returned 1 exit status
make: *** [makefile:66: SensorsRaw_01.elf] Error 1
"make -j4 all" terminated with exit code 2. Build might be incomplete.

14:21:55 Build Failed. 16 errors, 1 warnings. (took 1s.485ms)

Try the AC6 import option.

The STD peripheral driver code is in the repo.

My guess is the fresh/new project doesn’t know how to find code in the other directories, so you’ll need to configure the project, or just use the import AC6 option and it will pull in all those settings.

I did use the AC6 import option as you said but its not pulling the settings ?

I pushed the upgraded project, and added a few other IDE project files that had been excluded by a gitignore file.

Give that a try, hopefully that does the trick.

Thank you, I will have a look :slight_smile:

Wizard thank you for taking the time to update the files, they now load and compile correctly for me.
I really appreciate you help thanks again :slight_smile: My project is not LED based, its using an RGB laser, but it is using your sensor expansion board so would it be ok to post a few pictures up on these forums when its finished ?

1 Like

Yes of course! We’d love to see that!

1 Like