I need to connect an external sensor to the DA14695 WiRa USB development kit via I2C. The driver looks fairly straightforward but I have a question about initializing the interface. The code uses an assembler directive to create a list of init functions to call (bus_init_section) but how do I add the initialization of the I2C bus to this list? As a more general question, what is the methodology for adding peripheral support using this mechanism?
Device:
Hi apdobaj
Generally, we strongly recommend the usage of the adapters for accessing hardware peripherals because not only provide access to the peripheral, but also make sure that other tasks which are currently accessing it, suspend their operation until the peripheral is once again released. So you don't have to worry if another task tries accessing the same peripheral at the same time. Also, in sleep mode all the peripheral blocks are powered down.
If I understood correctly, you question is how to initialize the I2C peripheral block. Please take a look at theDA1469x教程I2C适配器的概念from the support portal. You will find all the appropriate steps toi initialize and use the I2C adapter.
Hope this helps! In case I misunderstood your question, please clarify it.
谢谢,PM_DIALOG.
I'm still having issues trying to get this i2c driver to work. The driver is re-registering the interface because it thinks the tx fifo has data in it. I placed some test code to disable the re-register and clear the fifo but now the code hangs at the call to OS_EVENT_WAIT in ad_i2c_write. The attached code should tell you everything you need to figure this out. Start with the i2c_init method in main.c. All changes are commented with the key word apdobaj.
Hi apdobaj,
I take a look at the main.c file and all the I2C transactions are implemented in i2c_init() which is called in the system_init().
The system_init() task is a highest priority task which should contain only the calls for initializing the system and the application. It should have what is the defaults in a typical project, it should create/initialize the resources (e.g. Mutexes, timers, structures), create the initial task(s) of the application.
The system_init() task must not be used for implementing the state machine of the application or any functionality in general such as I2C transactions. Regarding the I2C, a new task should be created in the system_init() with normal priority to run the application state machine and perform I2C transactions.
In my previous response, I had suggested to take a look at theDA1469x教程I2C适配器的概念so that you can understand how to use the I2C adapters.
As you can see in the tutorial, the system_init() creates the prvI2CTask_EEPROM() task where I2C adapter initialization should be done once at the beginning (ad_i2c_init). This task also executes the eeprom_data_writer() to open the adapter (ad_i2c_open()) and perform some I2C write transactions (ad_i2c_write()). When the I2C activity has been finished, then the adapter should be closed (ad_i2c_close()). I would recommend first checking the suggested tutorial and implement the same functionality in your own project.
谢谢,PM_DIALOG.
OK, I followed the tutorial and now am getting a bus fault when it tries to initialize the LCD. Please advise.
有人在那里吗?
Hi apdobaj,
感谢您来论坛。令人兴奋的消息!我们现在正在迁至我们的新论坛平台,将提供更好的功能,并包含在主对话框网站中。所有帖子和帐户都已迁移。我们现在只接受新论坛上的流量 - 请发布任何新线程//www.xmece.com/support
We’ll be fixing bugs / optimizing the searching and tagging over the coming days.
此票据已移植://www.xmece.com/forums/post/dialog-smartbond-bluetooth-low-energy-%E2%80%93-hardware-device-reference-designs/peripheral
Apologies for the delay – I’ll respond to you as soon as possible on the NEW forum thread.
谢谢,PM_DIALOG.