Hi, I'm using a RA4T1. I want to change GPT timer5 GTCNT value before starting it as 180 degrees off with timer0 in sync. My single line C code in hal_entry.c is below.
g_timer5_ctrl.p_reg->GTCNT = (PWMPeriod >> 1); //count init to 180 degrees
I check the disassembly, it corresponds to below code segment
170 g_timer5_ctrl.p_reg->GTCNT = (PWMPeriod >> 1); //count init to 180 degrees00000478: ldr r2, [pc, #264] ; (0x584 <hal_entry+684>)0000047a: ldrh r3, [r7, #0]0000047c: ldr r2, [r2, #8]0000047e: lsrs r3, r3, #1173 err = R_ELC_Open(&g_elc_ctrl, &g_elc_cfg);00000480: ldr r1, [pc, #260] ; (0x588 <hal_entry+688>)00000482: ldr r0, [pc, #264] ; (0x58c <hal_entry+692>)170 g_timer5_ctrl.p_reg->GTCNT = (PWMPeriod >> 1); //count init to 180 degrees00000484: str r3, [r2, #72] ; 0x48
I trace both in C and in disassembly in debugger, the content of GTCNT is not changed at all. Below is a picture linking C and disassembly.
In fact, all my single line c code attempting to change register value in hal_entry() seems not able to make the change. Can you help me understand why?
RA4T1_MicroInverter3.zipThis is the zip file of the entire project.
What I observe is that within hal_entry() function, I can't change register values for GTIOR, GTCCRC, GTCCRE, GTCNT of timer0 and timer5 while I'm able to start them at the same time by changing GTSTR value. Question is why I'm not able to change value to other register inside hal_entry() function.
Hello,Thank you for posting your question online.The reason you can't change some of the GPT register values is caused from the Write-Protection which you have enabled from the FSP.Is there any specific reason you have enabled such feature? If no, you could disable it and your issue will be resolved.Thank you,Panos
Panos, this solves my problem. There is no reason I need write protection. I wanted extra features. I must have clicked on write protection box accidently and did not realize it. Thank you. Dong