2015-11-12 04:53 AM
Hello,
2 years ago, I developed a piece of code for my STM32L1-Discovery board. It is an automated chicken coop door. It is working great.
Now, I have to copy this system for a friend of me (on a Nucleo-152RE board, and I was busy with copying the complete project into OpenSTM32 and rebuild it and finished. But.... It is not that easy....in the time I developed this system, I was using the Discovery FW package v1.0.2.
Now, It is compiling, But nothing happens on my Nucleo board. I also flashed a LED toggle into the board, but no LED. What can be wrong in this? Are these ''old'' libraries too old for the nucleo?2015-11-13 01:37 AM
Hi Jasper298,
I'd highly recommend you to try STM32L152RE-Nucleo examples under STM32Cube L1 package v1.4.0. STM32Cube_FW_L1_V1.4.0\Projects\STM32L152RE-Nucleo\ExamplesIt can be very useful.-Syrine-2015-11-13 03:38 AM
Are these ''old'' libraries too old for the nucleo?
I think you're just doing something wrong, I've ported stuff back and forth between DISCO and NUCLEO boards all the time.Pay special attention to clocks and pins, and solder bridges on the boards2015-11-17 06:37 AM
@Syrine
Yes, that's what I did. Now I have the board running with the new HAL drivers. But some function are not available in the HAL lib. For example the following:/* Enable SysTick Interrupt*/
NVIC_InitStructure.NVIC_IRQChannel = SysTick_IRQn ;
NVIC_InitStructure.NVIC_IRQChannelPreemptionPriority = 0;
NVIC_InitStructure.NVIC_IRQChannelSubPriority = 2;
NVIC_InitStructure.NVIC_IRQChannelCmd = ENABLE;
NVIC_Init(&NVIC_InitStructure);
/* EXTI configuration */
EXTI_ClearITPendingBit(EXTI_Line17);
EXTI_InitStructure.EXTI_Line = EXTI_Line17;
EXTI_InitStructure.EXTI_Mode = EXTI_Mode_Interrupt;
EXTI_InitStructure.EXTI_Trigger = EXTI_Trigger_Rising;
EXTI_InitStructure.EXTI_LineCmd = ENABLE;
EXTI_Init(&EXTI_InitStructure);
/* NVIC configuration */
NVIC_InitStructure.NVIC_IRQChannel = RTC_Alarm_IRQn;
NVIC_InitStructure.NVIC_IRQChannelPreemptionPriority = 0;
NVIC_InitStructure.NVIC_IRQChannelCmd = ENABLE;
NVIC_Init(&NVIC_InitStructure);
and:
EXTI_ClearITPendingBit(EXTI_Line17);
Don't know how to do this within the HAL libraries. I'm not an expert in C programming (FPGA developer), so sorry for these stupid questions.
especially the EXTI config...
2015-11-17 06:43 AM
@clive,
That's what i am thinking as well. But don't know what. Started with a complete new project for the HAL drivers, and almost everything is running in a correct way now. Only some problems because I can't find the EXTI config in the HAL lib for example. I would like to use the RTC Alarm IRQs. I think I can use this:void HAL_RTC_Alarm_IRQHandler(void){
if (__HAL_RTC_ALARM_GET_IT(&hrtc, RTC_IT_ALRA) != RESET){ instead of this in the Std lib: void RTC_Alarm_IRQHandler(void){
if (RTC_GetITStatus(RTC_IT_ALRA) != RESET){and previously, I've used the disable and enable alarm functions in Std lib, but this is not necessary anymore when setting the Alarm? Now I am using this: /*Deactivate before set alarm time*/
HAL_RTC_DeactivateAlarm(&hrtc, RTC_ALARM_A);
HAL_RTC_DeactivateAlarm(&hrtc, RTC_ALARM_B);RTC_AlarmTypeDef RTC_AlarmStructure;
//RTC_AlarmStructure.RTC_AlarmTime.RTC_H12 = RTC_H12_AM; RTC_AlarmStructure.AlarmTime.Hours = 0x04; RTC_AlarmStructure.AlarmTime.Minutes = 0x30; RTC_AlarmStructure.AlarmTime.Seconds = 0x00; RTC_AlarmStructure.AlarmDateWeekDay = 0x31; RTC_AlarmStructure.AlarmDateWeekDaySel = RTC_ALARMDATEWEEKDAYSEL_DATE; RTC_AlarmStructure.AlarmMask = RTC_ALARMMASK_DATEWEEKDAY; RTC_AlarmStructure.Alarm = RTC_ALARM_A; HAL_RTC_SetAlarm_IT(&hrtc, &RTC_AlarmStructure, RTC_FORMAT_BCD);RTC_AlarmStructure.AlarmTime.Hours = 0x15;
RTC_AlarmStructure.AlarmTime.Minutes = 0x35; RTC_AlarmStructure.AlarmTime.Seconds = 0x00; RTC_AlarmStructure.AlarmDateWeekDay = 0x31; RTC_AlarmStructure.AlarmDateWeekDaySel = RTC_ALARMDATEWEEKDAYSEL_DATE; RTC_AlarmStructure.AlarmMask = RTC_ALARMMASK_DATEWEEKDAY; RTC_AlarmStructure.Alarm = RTC_ALARM_B; HAL_RTC_SetAlarm_IT(&hrtc, &RTC_AlarmStructure, RTC_FORMAT_BCD); Previously, this: RTC_AlarmCmd(RTC_Alarm_A, DISABLE); RTC_AlarmCmd(RTC_Alarm_B, DISABLE); RTC_AlarmTypeDef RTC_AlarmStructure; //RTC_AlarmStructure.RTC_AlarmTime.RTC_H12 = RTC_H12_AM; RTC_AlarmStructure.RTC_AlarmTime.RTC_Hours = 0x04; RTC_AlarmStructure.RTC_AlarmTime.RTC_Minutes = 0x30; RTC_AlarmStructure.RTC_AlarmTime.RTC_Seconds = 0x00; RTC_AlarmStructure.RTC_AlarmDateWeekDay = 0x31; RTC_AlarmStructure.RTC_AlarmDateWeekDaySel = RTC_AlarmDateWeekDaySel_Date; RTC_AlarmStructure.RTC_AlarmMask = RTC_AlarmMask_DateWeekDay; RTC_SetAlarm(RTC_Format_BCD, RTC_Alarm_A, &RTC_AlarmStructure); RTC_AlarmStructure.RTC_AlarmTime.RTC_Hours = 0x15; RTC_AlarmStructure.RTC_AlarmTime.RTC_Minutes = 0x35; RTC_AlarmStructure.RTC_AlarmTime.RTC_Seconds = 0x00; RTC_AlarmStructure.RTC_AlarmDateWeekDay = 0x31; RTC_AlarmStructure.RTC_AlarmDateWeekDaySel = RTC_AlarmDateWeekDaySel_Date; RTC_AlarmStructure.RTC_AlarmMask = RTC_AlarmMask_DateWeekDay; RTC_SetAlarm(RTC_Format_BCD, RTC_Alarm_B, &RTC_AlarmStructure); /* Enable the alarm */ RTC_AlarmCmd(RTC_Alarm_A, ENABLE); /* Enable the RTC Alarm A interrupt */ RTC_ITConfig(RTC_IT_ALRA, ENABLE); /* Enable the alarm */ RTC_AlarmCmd(RTC_Alarm_B, ENABLE); /* Enable the RTC Alarm A interrupt */ RTC_ITConfig(RTC_IT_ALRB, ENABLE);