<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="https://devzone.nordicsemi.com/cfs-file/__key/system/syndication/rss.xsl" media="screen"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:wfw="http://wellformedweb.org/CommentAPI/" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>NRF5340 TWIM example code to communicate with nPM1300</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/114587/nrf5340-twim-example-code-to-communicate-with-npm1300</link><description>Hello, 
 we want to control the nPM1300 from an NRF5340 without using Zephyr. Is there example code on 
 how to configure/control the TWIM driver for this? The NPMX archive seems to contain higher layers 
 of the stack, but I&amp;#39;m looking for the twim code</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Tue, 10 Sep 2024 09:57:47 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/114587/nrf5340-twim-example-code-to-communicate-with-npm1300" /><item><title>RE: NRF5340 TWIM example code to communicate with nPM1300</title><link>https://devzone.nordicsemi.com/thread/501879?ContentTypeID=1</link><pubDate>Tue, 10 Sep 2024 09:57:47 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:a31ac20c-cbed-4c19-869b-fd8be2c884fa</guid><dc:creator>Susheel Nuguru</dc:creator><description>[quote user="Bas van den Berg"]What I could find is that Zephyr didn&amp;#39;t seem to use TXRX..[/quote]
&lt;p&gt;Yes, That seems true. Need to understand the code architecture to see how this is working in Zephyr.&lt;/p&gt;
[quote user="Bas van den Berg"]Also I think the primary length should be 2 bytes, since the address is passed separately right?[/quote]
&lt;p&gt;Yup, you are right, my bad.&amp;nbsp;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: NRF5340 TWIM example code to communicate with nPM1300</title><link>https://devzone.nordicsemi.com/thread/501860?ContentTypeID=1</link><pubDate>Tue, 10 Sep 2024 08:47:57 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:5911aec2-848d-4026-965c-2c005a334d06</guid><dc:creator>Bas van den Berg</dc:creator><description>&lt;p&gt;I assume the nPM1300 works fine under Zephyr. Inside the Zephyr codebase the code seems spread out over an nPM1300 driver and an i2c driver. What I could find is that Zephyr didn&amp;#39;t seem to use TXRX..&lt;/p&gt;
&lt;p&gt;Also I think the primary length should be 2 bytes, since the address is passed separately right?&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: NRF5340 TWIM example code to communicate with nPM1300</title><link>https://devzone.nordicsemi.com/thread/501852?ContentTypeID=1</link><pubDate>Tue, 10 Sep 2024 08:08:23 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:3d5a5367-2977-44de-af58-29e2bdf59d9a</guid><dc:creator>Susheel Nuguru</dc:creator><description>&lt;p&gt;We do not support FreeRTOS on nRF53 officially and I did not had time to experiment with it as we went all in with Zephyr RTOS.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;But your question does not seem to be very specifically tied to the FreeRTOS.&lt;/p&gt;
&lt;p&gt;&lt;span&gt;To perform a read operation as described in the nPM specification, you would need to set up a TXRX transfer. This involves a write operation (to send the 7-bit device address and 16-bit register address) followed by a read operation (to read 8 bits).&lt;/span&gt;Maybe you should do something like this, haven&amp;#39;t tested this myself so use for template only.&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="c_cpp"&gt;nrfx_twim_xfer_desc_t xfer_desc;
xfer_desc.type = NRFX_TWIM_XFER_TXRX;
xfer_desc.address = device_address;
xfer_desc.primary_length = 3; // 7-bit device address + 16-bit register address
xfer_desc.secondary_length = 1; // 8 bits to read
xfer_desc.p_primary_buf = &amp;amp;write_buffer; // Buffer containing device and register addresses
xfer_desc.p_secondary_buf = &amp;amp;read_buffer; // Buffer to store read data

nrfx_err_t err_code = nrfx_twim_xfer(&amp;amp;twim_instance, &amp;amp;xfer_desc, flags);&lt;/pre&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: NRF5340 TWIM example code to communicate with nPM1300</title><link>https://devzone.nordicsemi.com/thread/501756?ContentTypeID=1</link><pubDate>Mon, 09 Sep 2024 13:13:25 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:9450a88f-853e-40ae-81b2-2c88e632fc20</guid><dc:creator>Bas van den Berg</dc:creator><description>&lt;p&gt;We are running FreeRTOS.&lt;/p&gt;
&lt;p&gt;So the twim_master.h basicallly contains one transfer function (nrfx_twim_xfer).&lt;/p&gt;
&lt;p&gt;Looking at 7.6 TWI in the nPM specification, i see a read is comprised of:&lt;/p&gt;
&lt;p&gt;-&amp;nbsp; sending 7-bit device address (+r/w bit)&lt;/p&gt;
&lt;p&gt;- sending 16 bit register address&lt;/p&gt;
&lt;p&gt;- reading 8 bits.&lt;/p&gt;
&lt;p&gt;How can i do this with the xfer function?&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;Regards,&lt;/p&gt;
&lt;p&gt;Bas&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: NRF5340 TWIM example code to communicate with nPM1300</title><link>https://devzone.nordicsemi.com/thread/501705?ContentTypeID=1</link><pubDate>Mon, 09 Sep 2024 11:27:31 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:750b0e67-c516-4898-951d-23b7574f5f9d</guid><dc:creator>runsiv</dc:creator><description>&lt;p&gt;Hi Bas&lt;/p&gt;
&lt;p&gt;Just out of curiosity, what do you plan to run on the nRF5340 as you are not using Zephyr?&amp;nbsp;&lt;/p&gt;
&lt;p&gt;As you mention the NPMX I presume you have looked into the &lt;a href="https://github.com/NordicSemiconductor/npmx" rel="noopener noreferrer" target="_blank"&gt;Working with nPM1300 in other SDKs&lt;/a&gt;?&amp;nbsp;&lt;/p&gt;
&lt;p&gt;i just need to understand the your goal when I talk with the PMIC team&lt;/p&gt;
&lt;p&gt;Regards&lt;/p&gt;
&lt;p&gt;Runar&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>