⚠️
Hi there.. thanks for coming to the forums. Exciting news! we’re now in the process of moving to our new forum platform that will offer better functionality and is contained within the main Dialog website. All posts and accounts have been migrated. We’re now accepting traffic on the new forum only - please POST any new threads at https://www.dialog-semiconductor.com/support . We’ll be fixing bugs / optimising the searching and tagging over the coming days.
7 posts / 0 new
Last post
apdobaj
Offline
Last seen: 7 months 2 weeks ago
Joined: 2020-10-15 16:12
Peripheral initialization

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: 
PM_Dialog
Offline
Last seen: 2 hours 31 min ago
Staff
Joined: 2018-02-08 11:03
Hi apdobaj

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 the DA1469x Tutorial I2C Adapter Concepts 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.

Thanks, PM_Dialog

apdobaj
Offline
Last seen: 7 months 2 weeks ago
Joined: 2020-10-15 16:12
I'm still having issues

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.

Attachment: 
PM_Dialog
Offline
Last seen: 2 hours 31 min ago
Staff
Joined: 2018-02-08 11:03
Hi 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 the DA1469x Tutorial I2C Adapter Concepts 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.

Thanks, PM_Dialog

apdobaj
Offline
Last seen: 7 months 2 weeks ago
Joined: 2020-10-15 16:12
OK, I followed the tutorial

OK, I followed the tutorial and now am getting a bus fault when it tries to initialize the LCD. Please advise.

apdobaj
Offline
Last seen: 7 months 2 weeks ago
Joined: 2020-10-15 16:12
Anybody out there? 

Anybody out there? 

PM_Dialog
Offline
Last seen: 2 hours 31 min ago
Staff
Joined: 2018-02-08 11:03
Hi apdobaj,

Hi apdobaj,

Thanks for coming to the forums. Exciting news! We’re now in the process of moving to our new forum platform that will offer better functionality and is contained within the main Dialog website. All posts and accounts have been migrated. We’re now accepting traffic on the NEW forum only - please POST any new threads at  https://www.dialog-semiconductor.com/support

We’ll be fixing bugs / optimizing the searching and tagging over the coming days.

This ticket has been ported on : https://www.dialog-semiconductor.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.

Thanks, PM_Dialog