I have a MCBSTM32 board which uses the STM32F107 and includes the CS42L52 audio CODEC. Has anyone had success using this CODEC with the dev board? I've written code to generate the 12 MHz MCLK input, but haven't tested it yet. I'm not sure if I'm on the right track or not. If anyone has examples of their code I would like to see them, I'm most curious about the clock input and if it's required for using the beep function on the CODEC.
int main(void) {
RCC->APB2ENR |= RCC_APB2ENR_IOPCEN | RCC_APB2ENR_AFIOEN; RCC->APB1ENR |= RCC_APB1ENR_TIM3EN;
GPIOC->CRL = 0x0b000000; // Enable pin 6 @ 50mhz
AFIO->MAPR = AFIO_MAPR_TIM3_REMAP; // Remap TIM3 pins to PC6, 7, 8 and 9
TIM3->PSC = 2; // Set prescaler to 2 (PSC + 1 = 3; SYSCLK(72MHz) / 3 = 12 MHz) TIM3->ARR = 1; // Auto reload value
TIM3->CCR1 = 1; // Start PWM duty for channel 1
TIM3->CCMR1 = TIM_CCMR1_OC1M;
TIM3->CCER = TIM_CCER_CC1E; // Enable compare on channel 1 TIM3->CR1 = TIM_CR1_CEN; // Start timer
//TIM3->DIER = TIM_DIER_UIE; // Enable update interrupt (timer level) //NVIC_EnableIRQ(TIM3_IRQn); // Enable interrupt from TIM3 (NVIC level)
while (1) {} }