sensorium / Mozzi

sound synthesis library for Arduino
https://sensorium.github.io/Mozzi/
GNU Lesser General Public License v2.1
1.05k stars 184 forks source link

Mozzi not working on STM32 #262

Closed justinjools22 closed 2 weeks ago

justinjools22 commented 2 weeks ago

I tested Mozzi code on Arduino Nano and it works but when I upload to STM32F103C8T6 blue it doesn't do anything. I have tested non-library wavetable sine code on STM32 which works with PWM on PA9.

I believe it's some software thing. The basic pwm Mozzi examples should just work as on Arduino Nano.

tfry-git commented 2 weeks ago

Hi!

Which version of Mozzi, and which STM32-core are you using? (Mozzi supports two different STM32 cores, and the output will be to different pins).

tomcombriat commented 2 weeks ago

Hi, Have you tried also the basic examples (not with an external Dac as you described on the forum)?

justinjools22 commented 2 weeks ago

I'm using STM32F103C8T6 blue and the latest Mozzi 2.0.0 download in Arduino library. My destination platform, what I want to use is STM32F411CEU6 black though.

On Fri, Jun 28, 2024 at 2:34 PM Thomas Friedrichsmeier < @.***> wrote:

Hi!

Which version of Mozzi, and which STM32-core are you using? (Mozzi supports two different STM32 cores, and the output will be to different pins).

— Reply to this email directly, view it on GitHub https://github.com/sensorium/Mozzi/issues/262#issuecomment-2196921066, or unsubscribe https://github.com/notifications/unsubscribe-auth/ADWZ6B4THHYR4EST5JHHUMLZJVQ7HAVCNFSM6AAAAABKBQG3E6VHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDCOJWHEZDCMBWGY . You are receiving this because you authored the thread.Message ID: @.***>

justinjools22 commented 2 weeks ago

Yes, I tried the Mozzi basic sine wave pwm which works on Arduino Nano but not on STM32F103C8T6 blue. If I try the Arduino library basic sine example, this works on STM32. I can't get any Mozzi code to work on STM32.

On Fri, Jun 28, 2024 at 3:59 PM Thomas Combriat @.***> wrote:

Hi, Have you tried also the basic examples (not with an external Dac as you described on the forum)?

— Reply to this email directly, view it on GitHub https://github.com/sensorium/Mozzi/issues/262#issuecomment-2197130175, or unsubscribe https://github.com/notifications/unsubscribe-auth/ADWZ6BZADYMKJBIOSPBNBBTZJV25JAVCNFSM6AAAAABKBQG3E6VHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDCOJXGEZTAMJXGU . You are receiving this because you authored the thread.Message ID: @.***>

tfry-git commented 2 weeks ago

I'm using STM32F103C8T6 blue and the latest Mozzi 2.0.0 download in Arduino library. My destination platform, what I want to use is STM32F411CEU6 black though.

What I meant is the software package you installed from the Board Manager (yes, it's confusing, that there are several). Anyway, perhaps the issue is as simple as looking at the wrong pin? Mono output would be expected on PA8 and PB8, by default, while you mentioned PA9?

justinjools22 commented 2 weeks ago

I downloaded package from https://github.com/stm32duino/BoardManagerFiles/raw/main/package_stmicroelectronics_index.json

I have pwm output on PA8 (D9 is Arduino Nano).

On Fri, Jun 28, 2024 at 6:09 PM Thomas Friedrichsmeier < @.***> wrote:

I'm using STM32F103C8T6 blue and the latest Mozzi 2.0.0 download in Arduino library. My destination platform, what I want to use is STM32F411CEU6 black though.

What I meant is the software package you installed from the Board Manager (yes, it's confusing, that there are several). Anyway, perhaps the issue is as simple as looking at the wrong pin? Mono output would be expected on PA8 and PB8, by default, while you mentioned PA9?

— Reply to this email directly, view it on GitHub https://github.com/sensorium/Mozzi/issues/262#issuecomment-2197344065, or unsubscribe https://github.com/notifications/unsubscribe-auth/ADWZ6B6GCWX2FNDMIUYU2STZJWKGBAVCNFSM6AAAAABKBQG3E6VHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDCOJXGM2DIMBWGU . You are receiving this because you authored the thread.Message ID: @.***>

justinjools22 commented 2 weeks ago

I'm also getting this error on STM32, whereas it works on Arduino Nano:

In file included from c:\Users\m\Documents\Arduino\libraries\Mozzi/internal/config_checks_generic.h:38:0, from c:\Users\m\Documents\Arduino\libraries\Mozzi/MozziGuts.h:31, from c:\Users\m\Documents\Arduino\libraries\Mozzi/Mozzi.h:33, from C:\Users\m\AppData\Local\Temp.arduinoIDE-unsaved2024528-10508-l4t72n.z93ph\Sinewave\Sinewave.ino:22: c:\Users\m\Documents\Arduino\libraries\Mozzi/internal/mozzi_macros.h:93:47: error: missing binary operator before token "("

elif defined(GNUC) && __has_cpp_attribute(deprecated)

                                           ^

In file included from c:\Users\m\Documents\Arduino\libraries\Mozzi/internal/MozziGuts_impl_STM32duino.hpp:40:0, from c:\Users\m\Documents\Arduino\libraries\Mozzi/internal/MozziGuts.hpp:49, from c:\Users\m\Documents\Arduino\libraries\Mozzi/MozziGuts.h:205, from c:\Users\m\Documents\Arduino\libraries\Mozzi/Mozzi.h:33, from C:\Users\m\AppData\Local\Temp.arduinoIDE-unsaved2024528-10508-l4t72n.z93ph\Sinewave\Sinewave.ino:22: c:\Users\m\Documents\Arduino\libraries\Mozzi/internal/MozziGuts_impl_STM32duino_analog.hpp:69:2: error: #error "ADC sampling time could not be defined for internal channels!"

error "ADC sampling time could not be defined for internal channels!"

On Fri, Jun 28, 2024 at 6:21 PM justin jools @.***> wrote:

I downloaded package from

https://github.com/stm32duino/BoardManagerFiles/raw/main/package_stmicroelectronics_index.json

I have pwm output on PA8 (D9 is Arduino Nano).

On Fri, Jun 28, 2024 at 6:09 PM Thomas Friedrichsmeier < @.***> wrote:

I'm using STM32F103C8T6 blue and the latest Mozzi 2.0.0 download in Arduino library. My destination platform, what I want to use is STM32F411CEU6 black though.

What I meant is the software package you installed from the Board Manager (yes, it's confusing, that there are several). Anyway, perhaps the issue is as simple as looking at the wrong pin? Mono output would be expected on PA8 and PB8, by default, while you mentioned PA9?

— Reply to this email directly, view it on GitHub https://github.com/sensorium/Mozzi/issues/262#issuecomment-2197344065, or unsubscribe https://github.com/notifications/unsubscribe-auth/ADWZ6B6GCWX2FNDMIUYU2STZJWKGBAVCNFSM6AAAAABKBQG3E6VHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDCOJXGM2DIMBWGU . You are receiving this because you authored the thread.Message ID: @.***>

justinjools22 commented 2 weeks ago

Finally got it working.

Selecting Generic STM32F1 series, Board part number BluePill STM32F103C6 Connected to PA8

DAC MCP4822 now works with code example: FMsynth_MCP4921_mono_12bits

define SS_PIN PB1

It sounds so much clearer and hi-fi that 8 bit pwm on Arduino Nano :)

Thanks for listening. If often just requires running it by someone and reviewing it.

On Fri, Jun 28, 2024 at 6:28 PM justin jools @.***> wrote:

I'm also getting this error on STM32, whereas it works on Arduino Nano:

In file included from c:\Users\m\Documents\Arduino\libraries\Mozzi/internal/config_checks_generic.h:38:0, from c:\Users\m\Documents\Arduino\libraries\Mozzi/MozziGuts.h:31, from c:\Users\m\Documents\Arduino\libraries\Mozzi/Mozzi.h:33, from C:\Users\m\AppData\Local\Temp.arduinoIDE-unsaved2024528-10508-l4t72n.z93ph\Sinewave\Sinewave.ino:22: c:\Users\m\Documents\Arduino\libraries\Mozzi/internal/mozzi_macros.h:93:47: error: missing binary operator before token "("

elif defined(GNUC) && __has_cpp_attribute(deprecated)

                                           ^

In file included from c:\Users\m\Documents\Arduino\libraries\Mozzi/internal/MozziGuts_impl_STM32duino.hpp:40:0, from c:\Users\m\Documents\Arduino\libraries\Mozzi/internal/MozziGuts.hpp:49, from c:\Users\m\Documents\Arduino\libraries\Mozzi/MozziGuts.h:205, from c:\Users\m\Documents\Arduino\libraries\Mozzi/Mozzi.h:33, from C:\Users\m\AppData\Local\Temp.arduinoIDE-unsaved2024528-10508-l4t72n.z93ph\Sinewave\Sinewave.ino:22: c:\Users\m\Documents\Arduino\libraries\Mozzi/internal/MozziGuts_impl_STM32duino_analog.hpp:69:2: error: #error "ADC sampling time could not be defined for internal channels!"

error "ADC sampling time could not be defined for internal channels!"

On Fri, Jun 28, 2024 at 6:21 PM justin jools @.***> wrote:

I downloaded package from

https://github.com/stm32duino/BoardManagerFiles/raw/main/package_stmicroelectronics_index.json

I have pwm output on PA8 (D9 is Arduino Nano).

On Fri, Jun 28, 2024 at 6:09 PM Thomas Friedrichsmeier < @.***> wrote:

I'm using STM32F103C8T6 blue and the latest Mozzi 2.0.0 download in Arduino library. My destination platform, what I want to use is STM32F411CEU6 black though.

What I meant is the software package you installed from the Board Manager (yes, it's confusing, that there are several). Anyway, perhaps the issue is as simple as looking at the wrong pin? Mono output would be expected on PA8 and PB8, by default, while you mentioned PA9?

— Reply to this email directly, view it on GitHub https://github.com/sensorium/Mozzi/issues/262#issuecomment-2197344065, or unsubscribe https://github.com/notifications/unsubscribe-auth/ADWZ6B6GCWX2FNDMIUYU2STZJWKGBAVCNFSM6AAAAABKBQG3E6VHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDCOJXGM2DIMBWGU . You are receiving this because you authored the thread.Message ID: @.***>