
- #GPIO PINS ON NUCLEO F401RE MOD#
- #GPIO PINS ON NUCLEO F401RE SERIAL#
- #GPIO PINS ON NUCLEO F401RE CODE#
FILE -> EXAMPLES -> LiquidCrystal -> HelloWorld. FILE -> EXAMPLES -> BASICS -> AnalogReadSerial. FILE -> EXAMPLES -> BASICS -> DigitalReadSerial.
#GPIO PINS ON NUCLEO F401RE SERIAL#
send an information trough a Serial port. measure a voltage by internal ADC converter. measure the voltage on a Digital input pin (BUTTON).
change the state of a GPIO pin (BLINK a LED). In the Arduino IDE are built in simple examples like: I’m going to show what happen when you use Arduino C programming language on a STM32F401RE Nucleo board. if this is the correct pin setting for your board.I tested how is the grade of portability of Arduino C language on STM Core microcontroller board. to use the example check your board schematic MCK = MCLK // master clock, some I2S chips ( like the CS42L22 ) need fast external clock provided by the MCU PT8211 16 Bit Digital to Analog Converter togehter with the SPI interface On this board you can use only certain chips like the the STM32F103C8 ( on the BluePill board ) has no I2S You can use e.g an Adafruit I2S amplifier with the MAX98357a chip to produce soundĬheck your microcontroller if it has an I2S interface.Į.g. If the microcontroller on your board supports an I2S interface ( not all do ) This example produces a digital sawtooth on the I2S interface for the This will also launch Wire.begin() and will initialize the codec with default values HAL_I2S_Transmit_DMA(&hi2s2, AudioSampleLR, 1) ") ĪudioSampleLR = AudioSampleLR = 0xAA55 Serial.println("erreur config horloge periph I2S. If (HAL_RCCEx_PeriphCLKConfig(&PeriphClkInitStruct) != HAL_OK) with HSI, leads to 48.08 KHz Word clock - adjust +/- 1 for fine tuning or use crystal (HSE) PeriphClkInitStruct.PeriphClockSelection = RCC_PERIPHCLK_I2S RCC_PeriphCLKInitTypeDef PeriphClkInitStruct If(SampleCounter FC = FS * 256 (or 12.288 MHz with FS = 48k) Void HAL_I2S_TxCpltCallback(I2S_HandleTypeDef *hi2s) Void HAL_I2S_TxHalfCpltCallback(I2S_HandleTypeDef *hi2s) HAL_NVIC_SetPriority(DMA1_Stream4_IRQn, 2, 0) SPI2 TX (used for I2S) is DMA Controller #1 (out of 2) stream 4 channel 0 AN4031 ST : table of DMA instance (controller #) vs channel vs peripheral DMA1_Stream4_IRQn interrupt configuration GPIO_InitStruct.Alternate = GPIO_AF6_I2S2ext External SD (full duplex, incoming I2S) GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_LOW GPIO_InitStruct.Alternate = GPIO_AF5_SPI2 GPIO_InitStruct.Pin = GPIO_PIN_12 | GPIO_PIN_13 | GPIO_PIN_15 This should work on a naked nucleo if a fellow member wants to test for us We don't use the codec yet, we only instanciated the object but it can be avoided for testing.
h file where you define what to compile with and what not
#GPIO PINS ON NUCLEO F401RE MOD#
The only mod we made to the stock STM32 arduino toolchain is to enable the I2S (and the dma I think) in the core config. I've overriden the weak IRQ handles and the I2S callbacks, but so far, I don't think I get in them. My guess is that the IRQ is triggered at the end of the dma transaction but goes to either a fault trap or in the never. When we launch the DMA for the first I2S transaction, the number of samples decided actually go out (master clock, word clock and samples are generated) then it freezes and the main loop isn't responsive. The main loop mirrors the switch state to the onboard led to check it's still running.
#GPIO PINS ON NUCLEO F401RE CODE#
The code is very basic so far but I don't have a debugger to check what is happening.
Happy to post our start code and try to get some help from this place where we've been reading quite a fair bit and learned a lot from (cheers). Now we're adding the DMA and the board freezes. We've been following a proper learning curve about I/O's configuration, clock settings etc and even got the I2S to work in polling mode and we could get the samples out, so SPI2 / I2S is properly configured We need to work with I2S and DMA to generate waveforms. We are using the STM32 duino to get trained on something that started as a "simple" project but we're stumped. As posted in the welcome thread, ARM noob here, our lab is migrating from 15 years of dev with microchip 8 and 16 bit MCU to ARM mcu.