epikao
June 14, 2022, 5:34am
#1
Hello,
Since I have implemented the following code, it can happen, but relatively rarely, that my program hangs, in this code.
I suspect it has to do with this “refresh”.
I am a little perplexed? How, where could be the error most likely hidden? Is my code used correctly like this?
Thank you
if( ((millis() - lastMillis7) >= 250) && (state <= 11) ){
lv_style_set_text_color(&style_screen_label_5_main_main_default, lv_color_make(0xff, 0xff, 0xff));
lastMillis7 = millis();
state++;
if(state & 1){
lv_style_set_bg_opa(&style_screen_chart_1_main_main_default, 255);
}else{
lv_style_set_bg_opa(&style_screen_chart_1_main_main_default, 0);
}
lv_obj_refresh_style(guider_ui.screen_chart_1, &style_screen_chart_1_main_main_default, LV_PART_MAIN|LV_STATE_DEFAULT);
}
epikao
June 14, 2022, 8:14am
#2
could following warning be the problem? But how can I avoid this warning?
epikao
June 14, 2022, 10:53am
#3
with the debugger it is not very clear what happens… I do not get any error, but it looks that it hangs/freezes at following code-row (lv_memcpy):
EDIT:
The debugger only stops at breakpoints in the “Systick_Handler” function, but not in the main loop…
It looks like you are not calling lv_obj_refresh_style
with the right parameter types. Please refer to the documentation .
I think in your case you want lv_obj_refresh_style(guider_ui.screen_chart_1, LV_PART_MAIN, LV_STYLE_PROP_ANY)
.
epikao
June 15, 2022, 8:23pm
#5
I set the following code before the SDRAM initialization and until now I didn’t have this problem again.
MPU_Region_InitTypeDef MPU_InitStruct;
// Disable the MPU
HAL_MPU_Disable();
// Configure the MPU attributes for SDRAM
MPU_InitStruct.Enable = MPU_REGION_ENABLE;
MPU_InitStruct.BaseAddress = 0xC0000000;
MPU_InitStruct.Size = MPU_REGION_SIZE_4MB;
MPU_InitStruct.AccessPermission = MPU_REGION_FULL_ACCESS;
MPU_InitStruct.IsBufferable = MPU_ACCESS_NOT_BUFFERABLE;
MPU_InitStruct.IsCacheable = MPU_ACCESS_NOT_CACHEABLE;
MPU_InitStruct.IsShareable = MPU_ACCESS_NOT_SHAREABLE;
MPU_InitStruct.Number = MPU_REGION_NUMBER0;
MPU_InitStruct.TypeExtField = MPU_TEX_LEVEL1;
MPU_InitStruct.SubRegionDisable = 0x00;
MPU_InitStruct.DisableExec = MPU_INSTRUCTION_ACCESS_DISABLE;
HAL_MPU_ConfigRegion(&MPU_InitStruct);
// Enable the MPU
HAL_MPU_Enable(MPU_PRIVILEGED_DEFAULT);