Other Parts Discussed in Thread: SYSCONFIG
Tool/software:
Note: We are running applications on the MCU-R5 core, along with Linux running on the A-53 core.
This thread has been locked.
If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.
Tool/software:
Note: We are running applications on the MCU-R5 core, along with Linux running on the A-53 core.
Hi Nisarg,
Thanks for your question.
Please allow me sometime to check if we support this and get back to you with clarifications if needed.
Regards,
Vaibhav
Hi Nisarg,
Thanks for your patience.
I took an empty example provided in the MCU PLUS SDK for AM62A and wrote a small callback function to demonstrate the same. I used MCU_DMTIMER1 for this application and you can download the file attached here and get started. Also look closely at the settings mentioned in SysConfig Timer section as attached below.
The project file which shows Timer Callback implementation: empty_am62ax-sk_mcu-r5fss0-0_nortos_ti-arm-clang.zip
I hope this helps.
Regards,
Vaibhav
Hello Vaibhav,
We are looking for FreeRTOS based information. So kindly provide all the configuration of "SysConfig" and API details to configure, create, and start the timer in the FreeRTOS-MCU-R5.
Thanks,
Nisarg
Hi Nisarg,
Thanks for your response.
You can go ahead and use the same code and SysConfig configuration for the FreeRtos implementation as well.
Let me know if you run into any trouble.
Looking forward to your response.
Regards,
Vaibhav
Hello Vaibhav,
Thanks for the information.
As per my understanding, the above timer is HW-based. Correct ??
Can we use the below Software-Timer FreeRTOS APIs and design our MCU-R5 firmware development on the TI Platform?
Link:-
1) https://www.freertos.org/FreeRTOS-Software-Timer-API-Functions.html
2) https://www.freertos.org/RTOS-software-timer.html
Thanks,
Nisarg
Greetings Nisarg,
Thank you very much for your follow up questions.
As per my understanding, the above timer is HW-based. Correct ??
That is a correct understanding.
Here are my thoughts below, yes you can go ahead and use the APIs you have mentioned..
I am also attaching screenshots of the APIs being used in MCU PLUS SDK AM62A.
xTimerCreate()
xTimerStart()
Hope this helps clarify your doubts.
Regards,
Vaibhav
Hi Nisarg,
Thanks for your response.
You can go ahead and use the same code and SysConfig configuration for the FreeRtos implementation as well.
Let me know if you run into any trouble.
Looking forward to your response.
Regards,
Vaibhav
Hi Vaibhav,
We need to configure the time (Timer tick period) b/w range of 0 to 65535 ms (millisecond) in your suggested HW-Timer. How do we configure that higher timing period in firmware code and syscfg file.
Any timing limitation in TI HW-Timer ? How do we configure above higher timing data (in seconds) in TI-HW Timer ?
Thanks,
Nisarg
Hello Vaibhav,
Any update on the last queries? We want to configure the timer's time in seconds. Can we configure a higher time (in seconds) in TI HW-Timer?
Also, how do we configure/change the timer's time runtime in firmware code?
Can we use the below code to change the HW-Timer's time runtime? Is it the correct approach to change the timer's time in firmware code without syscfg file? Please provide your input on it.
==============================================
static void setHwTimerDelay(uint32_t timerDelayinMs)
{
TimerP_Params timerParams;
gTimerBaseAddr[CONFIG_TIMER0] = (uint32_t)AddrTranslateP_getLocalAddr(CONFIG_TIMER0_BASE_ADDR);
TimerP_Params_init(&timerParams);
timerParams.inputPreScaler = CONFIG_TIMER0_INPUT_PRE_SCALER;
timerParams.inputClkHz = CONFIG_TIMER0_INPUT_CLK_HZ;
timerParams.periodInNsec = 0;
timerParams.periodInUsec = timerDelayinMs*1000;
timerParams.oneshotMode = 1;
timerParams.enableOverflowInt = 1;
timerParams.enableDmaTrigger = 0;
TimerP_setup(gTimerBaseAddr[CONFIG_TIMER0], &timerParams);
}
==============================================
Thanks,
Nisarg
Greetings Nisarg,
Thank you for your response.
I would suggest you to change the value in the SysConfig tool itself.
Please have a look at the attached screenshot, it shows that the maximum value for Tick Period is going to be: 1000000.
Looking forward to your response.
Regards,
Vaibhav
Hi Vaibhav,
I would suggest you to change the value in the SysConfig tool itself.
Please have a look at the attached screenshot, it shows that the maximum value for Tick Period is going to be: 1000000.
As per your attached screenshot, there is a limitation to setting the tick period in the 1000000 (usec) range in the syscfg file. We need to configure the timer tick period up to 65535 ms (milliseconds) range. How do we configure that higher-range tick period value in TI HW-Timer? Is it possible?
Also, as per our requirement, we need to change or reconfigure the timer tick-period runtime as an input parameter value. In that case, how do we change the timer's tick period runtime in the application code without using the syscfg file?
Thanks,
Nisarg
Hello Nisarg,
Allow me sometime to check if we can configure the desired value as per your requirement.
Regards,
Vaibhav
Hi Vaibhav,
Thanks for your replay.
We are waiting for your response on this.
Thanks,
Nisarg
Hello Vaibhav,
Any update on it ? We need urgent information on mentioned queries.
Thanks,
Nisarg
Greetings Nisarg,
Thank you for your patience.
Also, as per our requirement, we need to change or reconfigure the timer tick-period runtime as an input parameter value. In that case, how do we change the timer's tick period runtime in the application code without using the syscfg file?
This can be done but then it would require you to overwrite the value as stated below in the code section and run the setupHwTimerDelay again to make sure the new value of ticks is applied.
==============================================
static void setHwTimerDelay(uint32_t timerDelayinMs)
{TimerP_Params timerParams;
gTimerBaseAddr[CONFIG_TIMER0] = (uint32_t)AddrTranslateP_getLocalAddr(CONFIG_TIMER0_BASE_ADDR);
TimerP_Params_init(&timerParams);
timerParams.inputPreScaler = CONFIG_TIMER0_INPUT_PRE_SCALER;
timerParams.inputClkHz = CONFIG_TIMER0_INPUT_CLK_HZ;
timerParams.periodInNsec = 0;
timerParams.periodInUsec = timerDelayinMs*1000;
timerParams.oneshotMode = 1;
timerParams.enableOverflowInt = 1;
timerParams.enableDmaTrigger = 0;
TimerP_setup(gTimerBaseAddr[CONFIG_TIMER0], &timerParams);
}==============================================
We need to configure the timer tick period up to 65535 ms
I am going to comment on this in sometime.
Regards,
Vaibhav
Hello Vaibhav,
Any update on it ? We need above information asap.
Thanks,
Nisarg
Hello Nisarg,
I am having conversation with the dev team on this and I will let you know in few hours.
Regards,
Vaibhav
Hello Nisarg.
A little update here. So, currently when I go ahead and set 65535 miliseconds, the value in nanoseconds turns out to be 65535 * 1000 * 100 ns.
This value is not a 32 bit value.
Hence, this approach is not feasible.
I would suggest you to use cascaded timers, please read the through the section from TRM below.
Regards,
Vaibhav
Hi Vaibhav,
Please provide sample application to achieve 65535 millisecond delay using suggested HW timer.
We need this information for our customer deliverable so it would be great help if you can provide this asap.
Thansk,
Nisarg
Greetings Nisarg,
Cascaded timers are currently a part of TI's SW offering.
Contradictory to this, I would have another expert comment on a way(apart from Cascaded Timers) to have 65535 ms.
Regards,
Vaibhav
Hello Nisarg,
Please try the below steps to achieve 65sec timer interrupts.
In this method you will have the timer interrupt resolution is minimum 1msec to maximum you can configure to till >66 sec.
Step 1 : Just update the timer input clock to HFOSC 32KHz instead of 25MHz
Step 2 : Initially configure 1sec time value and generate code
Step 3 : Copy the entire below and paste it into your main.c file and call the TimerP_init ( ) after the Board_init
Step4 : Next, remove Timer config from system cfg and genarate code
Step 5 : To get different timer interrupts you need to change this macro in the form of nsec .
CONFIG_TIMER0_NSEC_PER_TICK
For example if you need 1sec time interrupt for that you need to give count value as 1000000000
Try with above steps and see if this works .
Regards,
Anil.
Hi Anil,
We have checked in our "syscfg" file and we found below option for the "Input Clock Source". I have found that no "MCU_HFOSC0_CLKOUT_32K" related option available in my list compare to your shared screenshot of timer configuration.
Kindly check below screenshot and let us know which "Input Clock Source" option we need to use for the 32KHz input clock source for our requirement ??
Also 2nd Query, Related to below thing,
Step 5 : To get different timer interrupts you need to change this macro in the form of nsec .
CONFIG_TIMER0_NSEC_PER_TICK
For example if you need 1sec time interrupt for that you need to give count value as 1000000000
Try with above steps and see if this works .
typedef struct TimerP_Params_ { uint32_t inputPreScaler; /**< input pre-scaler divisor ro apply * * \note MUST be power of 2 and between 1 and 256 for GP Timer * \note MAKE sure this value is not 0 * \note This field is valid only when underlying timer is DM Timer. * \note This field is not valid when underlying timer is RTI Timer. Set to 1 in this case. */ uint32_t inputClkHz; /**< Timer input clock in unit of Hz before pre-scaler, system initialization MUST * make any system level muxes, PLLs, power required to input this clock are setup properly * * \note MAKE sure this value is not 0 */ uint32_t periodInUsec; /**< Timer period in units of usecs, internally \ref TimerP_Params.inputClkHz * and TimerP_Params.inputPreScaler is used to compute the value to be put inside the timer HW register * * \note When value is 0, \ref periodInNsec is used instead * \note When both \ref periodInUsec and \ref periodInNsec are non-zero, \ref periodInNsec is used */ uint32_t periodInNsec; /**< Timer period in units of nsecs, internally \ref TimerP_Params.inputClkHz * and TimerP_Params.inputPreScaler is used to compute the value to be put inside the timer HW register * * \note When value is 0, \ref periodInUsec is used instead * \note When both \ref periodInUsec and \ref periodInNsec are non-zero, \ref periodInNsec is used */ uint32_t oneshotMode; /**< 0: continuous mode of operation, 1: oneshot mode of operation * * \note NOT supported for RTI timer, always set to 0 in this case. */ uint32_t enableOverflowInt; /**< 0: Do not enable timer overflow interrupt, 1: enable timer overflow interrupt */ uint32_t enableDmaTrigger; /**< 0: Do not enable DMA trigger from timer, 1: enable DMA trigger from timer */ } TimerP_Params;
uint32_t periodInNsec;
"periodInNsec" variable used data-type of "uint32_t " and range of "uint32_t" datatype is 0-4294967295.
For 65.535 Seconds,
Kindly check below screenshot and let us know which "Input Clock Source" option we need to use for the 32KHz input clock source for our requirement ??
Hello Nisarg,
Please select a 32KHz (CLK_32_RC) clock source.
For example, you need to generate an interrupt for the maximum value is 66sec.
For 1 sec, we need to configure value 32000 in the overflow register, and we need to configure the value 2112000, which is less than the 32bit value of 66 sec.
For 1msec, you need to configure a 32 count value.
Now we are sure that we need to change the driver for this input and let's see what minimum change needed to fix this issue in the driver.
Method 1 :
So, if you change the variable to 64 bit , select 32KHz clock source and pass timeout value in the form nsec in the periodInNsec .Your code should work and will get the timeout value till 66sec.
Method 2 :
Instead of the above change, you can directly write the counter value in to the overflow register.
Like the method below. Here, you can directly update the timer overflow count value in the nsec variable. In this you don't need change the variable size to 64bit
There are other methods as well like dividing scale factors with the current input clock and chose method 1 and see if you still have the issues or not.
Regards,
Anil.
Hello Anil,
We tried to rebuild the SDK Libraries using below command (For changes in Driver) but getting failure in building.
Build steps Link:- Rebuilding libraries (SDK libraries)
1) AM62Ax MCU+ SDK: Build a Hello World example (ti.com)
2) AM62Ax MCU+ SDK: Using SDK with Makefiles (ti.com)
Command:-
cd ${SDK_INSTALL_PATH} gmake -s libs PROFILE=debug
Error Log:-
PS C:\ti\mcu_plus_sdk_am62ax_09_02_00_38> PS C:\ti\mcu_plus_sdk_am62ax_09_02_00_38> gmake.exe libs PROFILE=debug C:/TI/ccs1260/ccs/utils/bin/gmake -C . -f makefile.am62ax libs PROFILE=debug DEVICE_TYPE=GP gmake[1]: Entering directory 'C:/ti/mcu_plus_sdk_am62ax_09_02_00_38' C:/TI/ccs1260/ccs/utils/bin/gmake -C source/board -f makefile.am62ax.r5f.ti-arm-clang all gmake[2]: Entering directory 'C:/ti/mcu_plus_sdk_am62ax_09_02_00_38/source/board' C:/ti/ccs1260/ccs/utils/cygwin/mkdir -p obj/am62ax/ti-arm-clang/debug/r5f/board/ gmake[2]: Leaving directory 'C:/ti/mcu_plus_sdk_am62ax_09_02_00_38/source/board' C:/TI/ccs1260/ccs/utils/bin/gmake -C source/board -f makefile.am62ax.c75x.ti-c7000 all gmake[2]: Entering directory 'C:/ti/mcu_plus_sdk_am62ax_09_02_00_38/source/board' C:/ti/ccs1260/ccs/utils/cygwin/mkdir -p obj/am62ax/ti-c7000/debug/c75x/board/ Compiling: board.am62ax.c75x.ti-c7000.debug.lib: ioexp/ioexp_tca6424.c C:/ti/ti-cgt-c7000_4.1.0.LTS/bin/cl7x -mv7504 --abi=eabi -q -mo -pden -pds=238 -pds=880 -pds1110 --endian=little --disable_inlining -ea.se71 --emit_warnings_as_errors --diag_suppress=770 --diag_suppress=69 --diag_suppress=70 -Dxdc_target_name__=C71 -D_DEBUG_=1 --opt_level=0 --symdebug:dwarf -DBUILD_C7X_1 -DBUILD_C7X -IC:/ti/ti-cgt-c7000_4.1.0.LTS/include -IC:/ti/mcu_plus_sdk_am62ax_09_02_00_38/source -DSOC_AM62AX -ppd=obj/am62ax/ti-c7000/debug/c75x/board//ioexp_tca6424.d -ppa -fr=obj/am62ax/ti-c7000/debug/c75x/board// -fc=ioexp/ioexp_tca6424.c process_begin: CreateProcess(NULL, C:/ti/ti-cgt-c7000_4.1.0.LTS/bin/cl7x -mv7504 --abi=eabi -q -mo -pden -pds=238 -pds=880 -pds1110 --endian=little --disable_inlining -ea.se71 --emit_warnings_as_errors --diag_suppress=770 --diag_suppress=69 --diag_suppress=70 -Dxdc_target_name__=C71 -D_DEBUG_=1 --opt_level=0 --symdebug:dwarf -DBUILD_C7X_1 -DBUILD_C7X -IC:/ti/ti-cgt-c7000_4.1.0.LTS/include -IC:/ti/mcu_plus_sdk_am62ax_09_02_00_38/source -DSOC_AM62AX -ppd=obj/am62ax/ti-c7000/debug/c75x/board//ioexp_tca6424.d -ppa -fr=obj/am62ax/ti-c7000/debug/c75x/board// -fc=ioexp/ioexp_tca6424.c, ...) failed. make (e=2): The system cannot find the file specified. makefile.am62ax.c75x.ti-c7000:95: recipe for target 'ioexp_tca6424.obj' failed gmake[2]: *** [ioexp_tca6424.obj] Error 2 gmake[2]: Leaving directory 'C:/ti/mcu_plus_sdk_am62ax_09_02_00_38/source/board' makefile.am62ax:321: recipe for target 'board_c75x.ti-c7000' failed gmake[1]: *** [board_c75x.ti-c7000] Error 2 gmake[1]: Leaving directory 'C:/ti/mcu_plus_sdk_am62ax_09_02_00_38' makefile:71: recipe for target 'libs' failed gmake: *** [libs] Error 2 PS C:\ti\mcu_plus_sdk_am62ax_09_02_00_38>
Kindly let us know above steps are correct to build the driver after changes or not ? Please check above details and help us on that.
2nd Query:-
Checked below file for TimerP_setup() API and found that "periodInUsec" parameter for the "TimerP_Params" Structure.
File:- ./mcu_plus_sdk_am62ax_09_01_00_39/source/kernel/nortos/dpl/common/TimerP.c
As per above API calculation, Can we use the "periodInUsec" to configure the higher range value (up-to 65 second) in 32KHz (CLK_32_RC) input-clock source ????
Please check above API details where "timeInNsec, inputClkHz, timerCycles;" having data type of "uint64_t".
Please check above API calculation, Logic and data-type details and let us know on use of "periodInUsec" for 0 to 65535 ms (millisecond) time-range using 32KHz (CLK_32_RC) input-clock source.
We are waiting for your response on above queries.
Thanks,
Nisarg
Hello Nisarg,
Meanwhile we wait for comments from Anil, I would like you to make sure that you have downloaded all the dependencies listed on this page: https://software-dl.ti.com/mcu-plus-sdk/esd/AM62AX/09_02_00_38/exports/docs/api_guide_am62ax/SDK_DOWNLOAD_PAGE.html
Few reasons for build failure include not having one or more dependencies not installed.
Looking forward to your response.
Regards,
Vaibhav