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.
工具与软件:
您好、TI:
我们想要在 SBL 的第一级初始化 DDR 之前使用 i2c 配置 PMIC、但发现初始化 DDR 和 i2c 的代码位于 System_init 函数中、该函数已自动生成。 在初始化 DDR 之前、我需要执行什么操作才能使用 I2C?
你好、吴
感谢您的提问。
请确认您是否在讨论屏幕截图顶部提到的文件目录?
请允许我们在 System_init ()内部查看 I2C 初始化的位置,因为根据我的理解 Drivers_open ()负责此功能。
请期待在几个工作日内得到回复。
此致、
Vaibhav
你好 Vaibhav Kumar 、
我所说的正是屏幕截图上的文件,很抱歉我再次确认 I2C 初始化在 Drivers_open() 函数中。
DDR 的初始化在 System_init()中、它还会配置时钟、以此类推。
但我们要在 DDR 初始化之前配置 PMIC、此过程需要 I2C。
根据我的理解,我应该不能修改 System_init(),因为它是自动生成的。
嗨、Wu
感谢您的耐心。
根据我的理解、我不应该修改 System_init ()、因为它是自动生成的。
是的、以上理解是正确的。 您将无法编辑 system_init() 因为它是通过 SysConfig 自动生成的。
若要按用户定义的顺序初始化外设、可创建另一个包含名称的函数 _System_init() 并复制生成的 SysConfig 内容 system_init() 位置。 可以在自定义函数中更改外设初始化的顺序。
现在在 main.c 中注释 System_init()函数调用并调用创建的自定义函数。
请查找以下示例代码。
/* main.c */ void _System_init(void) { /* DPL init sets up address transalation unit, on some CPUs this is needed * to access SCICLIENT services, hence this needs to happen first */ Dpl_init(); /* We should do sciclient init before we enable power and clock to the peripherals */ /* SCICLIENT init */ { int32_t retVal = SystemP_SUCCESS; retVal = Sciclient_direct_init(); DebugP_assertNoLog(SystemP_SUCCESS == retVal); } PowerClock_init(); /* Now we can do pinmux */ Pinmux_init(); /* finally we initialize all peripheral drivers */ OSPI_init(); GTC_init(); I2C_init(); DDR_init(&gDdrParams); /* UDMA */ { uint32_t instId; int32_t retVal = UDMA_SOK; for(instId = 0U; instId < CONFIG_UDMA_NUM_INSTANCES; instId++) { retVal += Udma_init(&gUdmaDrvObj[instId], &gUdmaInitPrms[instId]); DebugP_assert(UDMA_SOK == retVal); } } Drivers_uartInit(); } void main() { // System_init(); _System_init(); }
请告知我们上述解决方案是否有效。
此致、
Tushar