STM32F373 SDADC Calibration hardfault
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
2014-10-03 12:45 AM
Posted on October 03, 2014 at 09:45
Hello,
I would like to kindly ask for a help with calibration of SDADC peripheral on chip STM32F373. Im using SDADC with TIM19 triggered conversions 1000Hz. I have tried two variants of calibration A) /* Set CALIBCNT[1:0] bits in SDADC_CR2 register */ Converter.Instance->CR2 &= ~(SDADC_CR2_CALIBCNT); Converter.Instance->CR2 |= SDADC_CALIBRATION_SEQ_1; /* Set STARTCALIB in SDADC_CR2 */ Converter.Instance->CR2 |= SDADC_CR2_STARTCALIB; while( ( Converter.Instance->ISR & SDADC_ISR_EOCALF ) != SDADC_ISR_EOCALF ){ asd++; } Converter.Instance->CLRISR |= SDADC_ISR_CLREOCALF; B) //Start calibration in polling mode HAL_SDADC_CalibrationStart(&Converter, SDADC_CALIBRATION_SEQ_1); //Poll for the end of calibration HAL_SDADC_PollForCalibEvent(&Converter, HAL_MAX_DELAY); Both of these variants end with hard fault. Code hits polling cycle for EOCALF and then hardfault occurs. When I comment polling part everything works well and end of conversion interrupt gets fired every 1ms, data can be read from data register... only this calibration polling jumps to hardfault. I have noticed that if I set a breakpoint just one step after calibration start and than hit continue, no hardfault occurs... If I place waiting code for(int i=0; i<10000;i++); it jumps to hardfault as well. Could anybody give me an advice what am I doing wrong? With best regards Stanislav Subrt EDIT1: Oh have found workaround... setting up an end of calibration interrupt and clearing calibration flags in here. So interrupt mode works ok but im still confused what is going on in polling mode. Hope it helps.
1 REPLY 1
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
2016-02-10 09:05 AM
Posted on February 10, 2016 at 18:05Hi, I use this code to calibrate a channel of SDADC 1 stmf373HAL_SDADC_AssociateChannelConfig(&hsdadc1, SDADC_CHANNEL_4, SDADC_CONF_INDEX_0); HAL_SDADC_ConfigChannel(&hsdadc1, SDADC_CHANNEL_4, SDADC_CONTINUOUS_CONV_OFF); //HAL_SDADC_SelectRegularTrigger(&hsdadc1, SDADC_SOFTWARE_TRIGGER); //INICIAR CALIBRACION HAL_SDADC_CalibrationStart(&hsdadc1, SDADC_CALIBRATION_SEQ_1); HAL_SDADC_PollForCalibEvent(&hsdadc1, HAL_MAX_DELAY); HAL_SDADC_ConfigChannel(&hsdadc1, SDADC_CHANNEL_4, SDADC_CONTINUOUS_CONV_ON);