arjun.a
range data
5aefcf4
raw
history blame
10.6 kB
Ticket Name: RTOS/TDA2P-ABZ: timestamp in SBL
Query Text:
Part Number: TDA2P-ABZ Other Parts Discussed in Thread: TDA2 Tool/software: TI-RTOS Hi All, I am using VSDK 3.05. We have a requirement where we need to toogle a GPIO within 100ms of power up, i.e we need to toggle it in SBL. I have included csl_gpio.h in sbl_tda2xx_main.c. I have pin muxed the gpio inside the function SBLConfigTIEVMPad() After this I have toggled the gpio. Now I need to see whether that gpio is toggled within 100ms. Is there any api or any method to see this apart from using scope. Regards, Deepika
Responses:
Hi Deepika, You can read 32K Timer for the same. The counter starts from 0 at power up and the same is used by SBL for profiling. Regards, Rishabh
Hi Rishabh, Can you please refer to any example present in Vision SDK. Is it the timer register mentioned in sec 24.3 in the TRM ( 32-kHz Synchronized Timer (COUNTER_32K)). If that is not the case please let me know the exact register to read. Regards, Deepika
Hi Deepika, Yes I am referring to COUNTER_32K. Regards, Rishabh
Hi Deepika, Also you can directly call SBLUtilsRead32KTimer API as used by SBL. Regards, Rishabh
Hi Rishabh, The return type of this function is integer. What is its unit? Regards, Deepika
Deepika, The return type is unsigned integer. See SblPrintBootCycles API for conversion to milliseconds. Regards, Rishabh
Hi Deepika, Were you able to get the timestamp? Regards, Rishabh
Hi Rishabh, Thanks for the reply. I have added the following lines after the function SBLConfigTIEVMPad() : GPIOModuleEnable(SOC_GPIO1_BASE); GPIODirModeSet(SOC_GPIO1_BASE,TDA_LED0_GPIO1_26,GPIO_DIR_OUTPUT); GPIOPinWrite(SOC_GPIO1_BASE, TDA_LED0_GPIO1_26, GPIO_PIN_HIGH); timeValGpioToggleEnd=SBLUtilsRead32KTimer(); SblPrintBootCycles("Time at which gpio Toggled ", timeValGpioToggleEnd); I am getting the following output Time at which gpio Toggled - 19363 (1.65 ms) Now is this time after system start up ? How to identify this? Thanks Deepika
Deepika, What is the type for timeValGpioToggleEnd? It should be uint32_t. The calculation should give you 590.91 ms. I am not sure why you are not getting this. SBL profiling is done using the same API. Regards, Rishabh
Hi Rishabh, The type is uint32_t only. I have checked another function ARM_CCNT_Read().Can I try this? Also based on your inputs right now if it takes 590ms , is it possible to toggle a gpio within 100ms. Regards, Deepika
Hi Deepika, I missed that you are using TDA2Px and not TDA3xx, my bad. I will get back to you on this. Regards, Rishabh
Hi Deepika, You can use TIMER_32K on TDA2Px as well. Yes you can toggle GPIO well within 100 ms. It depends on lot of factors like boot mode, SBL execution, UART prints etc. You need to make sure that you run the code in such a way that you can meet 100 ms requirement. Similar time stamp mechanism is already implemented in TDA2P SBL for getting IPU1_0 start time. Regards, Rishabh
Hi Rishabh, I am using SBLUtilsRead32KTimer () and SblPrintBootCycles() as shown above and the time is showing 1.67 ms. Is this the time after start up? Right now I am using SD booting. Regards, Deepika
Deepika, Can you share the complete SBL log. Regards, Rishabh
Hi Rishabh, Please find the logs below,this is for a custom TDA2P board. TDA2Px SBL Boot DPLL Configuration Completed Clock Domain Configuration Completed Module Enable Configuration Completed TI EVM PAD Config Completed TDA2Px DDR Configuration DDR Config Completed ***************************************************************** SD Boot - file open completed successfully MPU CPU0 Image Load Completed IPU1 CPU0 Image Load Completed IPU1 CPU1 Image Load Completed DSP1 Image Load Completed DSP2 Image Load Completed EVE1 Image Load Completed EVE2 Image Load Completed App Image Download Completed Putting MPU CPU1 in Off mode EVE MMU configuration completed EVE MMU configuration completed ***************************************************************** PMCCNTR counts once every 64 clock cycles, multiple by 64 to get actual CPU cycles SBL Initial Config Cycles - 1742534 (148.69 ms) SOC Init Cycles - 205823 (17.56 ms) DDR Config Clock Cycles - 95837 (8.17 ms) App Image Load Cycles - 117493703 (10026.12 ms) Slave Core Bootup Cycles - 137065 (11.69 ms) SBL Boot-up Cycles - 119682810 (10212.93 ms) Time at which SBL started IPU1_0 - 343418 (29.30 ms) Time at which gpio Toggled - 14173 (1.20 ms) ***************************************************************** Jumping to MPU CPU0 App All cores UP[IPU1-0] 10.480448 s: ***** IPU1_0 Firmware build time 11:47:56 Jan 7 2019 [IPU1-0] 10.480692 s: *** SYSTEM: CPU Frequency <ORG = 212800000 Hz>, <NEW = 212800000 Hz> [IPU1-0] 10.568687 s: SYSTEM: Notify register to [IPU1-1] line 0, event 15... [IPU1-0] 10.568901 s: SYSTEM: Notify register to [DSP1] line 0, event 15... [IPU1-0] 10.568992 s: SYSTEM: Notify register to [DSP2] line 0, event 15... [IPU1-0] 10.569114 s: SYSTEM: Notify register to [EVE1] line 0, event 15... [IPU1-0] 10.569236 s: SYSTEM: Notify register to [EVE2] line 0, event 15... [IPU1-0] 10.569328 s: SYSTEM: Notify register to [HOST] line 0, event 15... [IPU1-0] 10.571097 s: *** UTILS: CPU MHz = 20 Mhz *** [IPU1-0] 10.571280 s: SYSTEM: System Common Init in progress !!! [IPU1-0] 10.582931 s: SYSTEM: IPC init in progress !!! [IPU1-0] 10.583053 s: SYSTEM: Notify init done !!! [IPU1-0] 10.585127 s: SYSTEM: MsgQ init done !!! [IPU1-0] 10.585310 s: SYSTEM: IPC init DONE !!! [IPU1-0] 10.590678 s: SYSTEM: System Common Init Done !!! [IPU1-0] 10.590831 s: SYSTEM: System Init in progress !!! [IPU1-0] 10.590922 s: SYSTEM: BSP Common Init in progress !!! [IPU1-0] 10.591014 s: SYSTEM: BSP Common Init Done !!! [IPU1-0] 10.591075 s: SYSTEM: BSP Platform Init in progress !!! [IPU1-0] 10.591258 s: SYSTEM: BSP Platform Init Done !!! [IPU1-0] 10.591349 s: SYSTEM: FVID2 Init in progress !!! [IPU1-0] 10.591502 s: SYSTEM: FVID2 Init Done !!! [IPU1-0] 10.591593 s: SYSTEM: VPS Init in progress !!! [IPU1-0] 10.591654 s: SYSTEM: VPDMA Descriptor Memory Address translation ENABLED [0xa0000000 -> 0x80000000] [IPU1-0] 10.595223 s: *** VPDMA Firmware Loading... *** [IPU1-0] 10.595345 s: VPDMA Firmware Address = 0x9fd1b5c0 [IPU1-0] 10.595437 s: VPDMA Load Address = 0x4897d004 [IPU1-0] 10.595589 s: VPDMA Firmware Version = 0x4d0001b8 [IPU1-0] 10.595681 s: VPDMA List Busy Status = 0x00000000 Can you please tell me why does SBL Initial Config Cycles takes 148ms Regards, Deepika
Deepika, Let's first try to resolve the timestamp issue. I see one problem here that needs to fixed in TDA2 SBL for IPU timestamp value. SblPrintBootCycles API has different implementation for TDA2xx and TDA3xx. When you are reading 32K timer you need to use implementation given in TDA3 SBL. As an experiment can you replace the implementation of this API with the one given in TDA3 SBL. You will correct timestamp although other time profiling will be wrong. Regards, Rishabh
Hi Rishabh, "When you are reading 32K timer you need to use implementation given in TDA3 SBL.As an experiment can you replace the implementation of this API with the one given in TDA3 SBL." I did'nt understood this So should I remove all the ARM_CCNT_Read() and use SBLUtilsRead32KTimer () in sbl_tda2xx_main.c Correct me if I am wrong Regards Deepika
Deepika, SblPrintBootCycles is defined in sbl_tda3xx_main.c and sbl_tda2xx_main.c. You need to replace the API definition given in sbl_tda2xx_main.c with the one given in sbl_tda3xx_main.c Regards, Rishabh
Hi Rishabh, With this I am getting a linker error. I cleaned it again. I added stdio.h and in snprintf function I modified the format specifier with %ld instead of %d snprintf(bootCyclesStr, (size_t) 8, "%ld", bootCycles); /home/deepika/FFC_sensor/scripts/..//sdk/ti/PROCESSOR_SDK_VISION_03_03_00_00/ti_components/cg_tools/linux/gcc-arm-none-eabi-4_9-2015q3/arm-none-eabi/lib/fpu/librdimon.a(rdimon-syscalls.o): In function `_sbrk': syscalls.c:(.text._sbrk+0x78): undefined reference to `end' collect2: error: ld returned 1 exit status Regards, Deepika
Hi Deepika, Use the below definition: uint32_t cyclesInMsInt = 0U, cyclesInMsFrac = 0U;
cyclesInMsInt = (bootCycles * 1000U) / SBL_32KTIMER_REFERENCE_VAL;
cyclesInMsFrac =
(((bootCycles * 1000U) % SBL_32KTIMER_REFERENCE_VAL) * 100U) / SBL_32KTIMER_REFERENCE_VAL;
UARTprintf("\n %s - %d (%d.%02d ms)",
cyclesString, bootCycles, cyclesInMsInt, cyclesInMsFrac); Regards, Rishabh
Hi Rishabh, Now it worked according to your expectations: SBL Initial Config Cycles - 1761638 (53760.92 ms) SOC Init Cycles - 205475 (6270.59 ms) DDR Config Clock Cycles - 95777 (2922.88 ms) DDR test Wait time Clock Cycles - 0 (0.0 ms) App Image Load Cycles - 124934131 (11599.10 ms) Slave Core Bootup Cycles - 136908 (4178.10 ms) SBL Boot-up Cycles - 127141766 (78970.77 ms) Time at which SBL started IPU1_0 - 368912 (11258.30 ms) Time at which gpio Toggled - 18850 (575.25 ms) Now tell me how you can I reduce this Gpio toggling time. Regards, Deepika
Deepika, Glad that this issue is resolved. Can you add a new API for getting time stamp for ipu1_0 and gpio with the provided definition so that you can see SBL profiling numbers correctly along with correct time stamps. Reducing boot time is not a straight forward action and cannot be done by some register configuration. Also please start a new thread for boot time reduction. Regards, Rishabh
HI Rishabh, Time at which SBL started IPU1_0------timeValStartIpu1_0 is already available in the present file.Can you please let me know what else can I add for ipu1_0. Regards, Deepika
Deepika, There are two places where 32K Timer will be used. One for ipu1_0 that was already there and the other you have added for gpio. At both places you need to use the API definition I provided you in this thread say SblPrintBootCycles32K. Regards, Rishabh
Hi Rishabh, Thanks a lot for your support. I have reverted to the original TI SDK code, with that the time has been reduced further to 332 ms. I will open a thread to reduce the boot time further. This is what I am currently getting : SBL Initial Config Cycles - 116409 (9.93 ms) SOC Init Cycles - 170606 (14.55 ms) DDR Config Clock Cycles - 89616 (7.64 ms) App Image Load Cycles - 96433659 (8229.0 ms) Slave Core Bootup Cycles - 130417 (11.12 ms) SBL Boot-up Cycles - 96941763 (8272.36 ms) Time at which SBL started IPU1_0 - 281181 (8580.96 ms) Time at which gpio Toggled - 10884 (332.15 ms) ***************************************************************** Regards, Deepika
Deepika, Thanks for the confirmation. I am closing this thread. Regards, Rishabh