KLKim Lillåsinowningmymistakes.hashnode.dev·Feb 11, 2024 · 2 min readSelecting the highest resolution STM32 USART clock divisorSTM32 USART stores a clock divisor into its USART_BRR register to configure the baudrate of the USART. The BRR register only has 16 bits in use, with the most significant 12 bits storing the clock divisor. The clock divisor and 8/16 sampling rate set...00
KLKim Lillåsinowningmymistakes.hashnode.dev·Feb 7, 2024 · 1 min readCareful about function-like macro parameter namingI needed to create a function-like macro which set a parameter in a default settings struct, simple enough. struct Settings { unsigned enabled; }; struct Settings defaultSettings; #define SetEnabled(enabled) (defaultSettings.enabled = enabled) ...00
KLKim Lillåsinowningmymistakes.hashnode.dev·Jan 31, 2024 · 2 min readCaPiTaLiZaTiOnI was in the middle of adding DMA to my STM32 QuadSPI driver using the ST HAL layer. For the HAL layer to update its QSPI state I need to catch the QUADSPI_IRQn IRQ and call the corresponding HAL QSPI IRQ-handler. The assembler code below is the STM3...00
KLKim Lillåsinowningmymistakes.hashnode.dev·Jan 30, 2024 · 2 min readYes, you can damage flash memoryI have been writing a driver and hooking up LittleFs to an external SPI connected flash memory, W25Q32BV from Winbond with 32Mbit of memory with 1024 erasable sectors. It worked well, I could write and read data and the file system was working just f...00
KLKim Lillåsinowningmymistakes.hashnode.dev·Jan 23, 2024 · 2 min readKeep those configs alive or forever regret itFor today's mistake I was initializing LittleFs by defining its lsf_config struct inside my wrapper code init function. static lfs_t fileSystem; int LfsReadCallback(const struct lfs_config *c, lfs_block_t block, lfs_off_t off, void *buffer, lfs_size...00