<?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>PPI on TWI instance 1 not working</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/62400/ppi-on-twi-instance-1-not-working</link><description>I have adapted the &amp;quot; nrf52-mpu-easydma-using-timers-and-drivers &amp;quot; project from Github that I saw referenced in another post and have successfully modified it to work with my A/D converter on TWI instance 0. However, I have implemented a virtual &amp;quot;ditto</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Wed, 26 Feb 2020 12:00:25 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/62400/ppi-on-twi-instance-1-not-working" /><item><title>RE: PPI on TWI instance 1 not working</title><link>https://devzone.nordicsemi.com/thread/254282?ContentTypeID=1</link><pubDate>Wed, 26 Feb 2020 12:00:25 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:6d3ea642-9b05-44c6-8f67-009af6bbbb80</guid><dc:creator>J&amp;#248;rgen Holmefjord</dc:creator><description>&lt;p&gt;Thanks for the explanation. If you are doing the address/buffer update in software/interrupt handler I can understand that you made it work, I just thought that you had a solution to do this with PPI only, which I could not understand how would be possible.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: PPI on TWI instance 1 not working</title><link>https://devzone.nordicsemi.com/thread/254281?ContentTypeID=1</link><pubDate>Wed, 26 Feb 2020 11:22:16 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:e2a64c77-fc15-4029-9d31-666f143b74e5</guid><dc:creator>Jared</dc:creator><description>&lt;p&gt;It&amp;#39;s not an elegant solution, but I&amp;#39;ll describe it the best I can.&amp;nbsp; I didn&amp;#39;t actually change the slave address using PPI, as I understand it.&amp;nbsp; I am using the timer handler (not the one for the counter, but for the other timer in the PPI implementation - it&amp;#39;s unused in the sample project) to process two compare events.&amp;nbsp; On one event, the proper DAC data value for this pass through is stored in a variable and a task scheduler function call is made.&amp;nbsp; This particular task scheduler function uses nrf_twim_address_set()/nrf_twim_tx_buffer_set() to set the DAC slave address and update the TX buffer with the write data.&amp;nbsp; I don&amp;#39;t make the actual xfer here - just wait for the existing PPI functions to&amp;nbsp;perform the TXRX for the DAC.&amp;nbsp; On the next pass through, the other compare event includes a call to the task scheduler that uses the same two nrf functions to restore the slave address and TX data back to the appropriate values for the ADC.&amp;nbsp; So, I had to increase the timer to double the frequency since it now has to perform both the DAC and ADC xfers while maintaining my target sampling rate.&amp;nbsp; I have simple logic to make sure only one of the compare events (which are very similar in # of ticks) results in updates to the slave address / tx data for each pass through.&amp;nbsp; I realize the timer handler can have up to 250us of delay since I&amp;#39;m also using a SoftDevice, so I had to take that into account to ensure that the address updates don&amp;#39;t happen too late (timer is at over 1ms, so I have plenty of time).&amp;nbsp; I&amp;#39;m happy to answer any other questions, as I&amp;#39;ve received tremendous support through the dev zone and&amp;nbsp;will clarify/contribute if I can.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: PPI on TWI instance 1 not working</title><link>https://devzone.nordicsemi.com/thread/254280?ContentTypeID=1</link><pubDate>Tue, 25 Feb 2020 20:33:50 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:9f97dba4-ff53-472b-b564-a653cb92f7bc</guid><dc:creator>J&amp;#248;rgen Holmefjord</dc:creator><description>&lt;p&gt;Can you explain how you managed to change the slave address using PPI? Or how do you differentiate which device you read from?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: PPI on TWI instance 1 not working</title><link>https://devzone.nordicsemi.com/thread/254279?ContentTypeID=1</link><pubDate>Tue, 25 Feb 2020 17:07:23 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:47bb60f8-2639-4267-a093-4a100bf01095</guid><dc:creator>Jared</dc:creator><description>&lt;p&gt;Thank you, Jorgen.&amp;nbsp; I implemented the TWIM commands as you suggested and have found a way to achieve my sampling frequency target while writing TWI read values from both peripheral devices from the same TWI bus into the RAM buffer using PPI.&amp;nbsp; I suppose we&amp;#39;ve now proven that your original suggestion from the previously linked thread is indeed achievable.&amp;nbsp; Thanks again.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: PPI on TWI instance 1 not working</title><link>https://devzone.nordicsemi.com/thread/254278?ContentTypeID=1</link><pubDate>Tue, 25 Feb 2020 12:22:49 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:0ec2179c-cf6f-45f8-b73f-172fc70f84b9</guid><dc:creator>J&amp;#248;rgen Holmefjord</dc:creator><description>&lt;p&gt;You should use&amp;nbsp;&lt;span&gt;&lt;a href="https://infocenter.nordicsemi.com/topic/sdk_nrf5_v16.0.0/group__nrf__twim__hal.html#gaddf452f9f0b88ffaa818ced16f7c87dc"&gt;nrf_twim_address_set&lt;/a&gt;()/&lt;a href="https://infocenter.nordicsemi.com/topic/sdk_nrf5_v16.0.0/group__nrf__twim__hal.html#ga09dd75b2fcba0f334cf68e1307268f38"&gt;nrf_twim_tx_buffer_set&lt;/a&gt;(). nrf_twi is for the legacy TWI peripheral, which does not support EasyDMA, i.e., you will have to update the register for every byte you transmit/receive.&lt;/span&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: PPI on TWI instance 1 not working</title><link>https://devzone.nordicsemi.com/thread/254277?ContentTypeID=1</link><pubDate>Tue, 25 Feb 2020 10:50:43 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:14a4dd6d-c8e7-4fa5-986b-fdf22f1dee5d</guid><dc:creator>Jared</dc:creator><description>&lt;p style="text-align:left;"&gt;Thanks for the response.&amp;nbsp; It&amp;#39;s ok for one device on the bus to not use ppi, as timing isn&amp;#39;t critical and it doesn&amp;#39;t require a read (only write).&amp;nbsp; Is it possible to update the slave address and tx data value without restarting the RAM buffer?&lt;/p&gt;
&lt;p style="text-align:left;"&gt;I was looking at the TWI HAL functions.&amp;nbsp;&amp;nbsp;&lt;span&gt;nrf_twi_address_set() looks like it might work for updating the slave address, but the&amp;nbsp;nrf_twi_txd_set() function only sets up one byte to transfer, and I need two bytes.&lt;/span&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: PPI on TWI instance 1 not working</title><link>https://devzone.nordicsemi.com/thread/254276?ContentTypeID=1</link><pubDate>Tue, 25 Feb 2020 10:03:30 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:8b472ef0-06f8-477d-a0c9-bea3e25b4ec1</guid><dc:creator>J&amp;#248;rgen Holmefjord</dc:creator><description>&lt;p&gt;I&amp;#39;m sorry but I do not think that I considered the address when I posted my answer in the thread you linked. There is no way to update the slave address register using PPI. If you want to interface devices with different addresses and trigger transfers using PPI, you will have to use two separate TWIM instances.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: PPI on TWI instance 1 not working</title><link>https://devzone.nordicsemi.com/thread/254275?ContentTypeID=1</link><pubDate>Tue, 25 Feb 2020 04:12:59 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:b9344530-57b7-47b0-8003-e54efd5d8925</guid><dc:creator>Jared</dc:creator><description>&lt;p&gt;Yes, that was it.&amp;nbsp; I now have the 2nd TWI peripheral, TWI1, operating with PPI as I would expect. A device driver I received for the accelerometer had some bugs that I fixed, as described in my previous comment.&amp;nbsp; Should I mark this as complete and generate a new ticket for the two slaves/one bus issue?&amp;nbsp; Thanks.&amp;nbsp;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: PPI on TWI instance 1 not working</title><link>https://devzone.nordicsemi.com/thread/254274?ContentTypeID=1</link><pubDate>Tue, 25 Feb 2020 03:38:30 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:47e2fd37-6b34-4029-996f-2a727d5b521e</guid><dc:creator>Jared</dc:creator><description>&lt;p&gt;RE: the initial problem - my current thinking is that there is an issue with the init routine on my accelerometer because I&amp;#39;ve realized it doesn&amp;#39;t complete all of the TWI transfers and the SDA line gets stuck low at some point.&amp;nbsp; I&amp;#39;ve seen this happen when I use intermingled TWI drivers (nrf_drv_twi_tx instead of&amp;nbsp;nrf_drv_twi_xfer). So,&amp;nbsp;I suspect this is not a&amp;nbsp;PPI-related problem.&amp;nbsp; I will try to fix this and update later.&amp;nbsp; However, my issue with multiple slaves on the same TWI bus remains to be an issue.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: PPI on TWI instance 1 not working</title><link>https://devzone.nordicsemi.com/thread/254273?ContentTypeID=1</link><pubDate>Tue, 25 Feb 2020 01:54:20 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:0c187e28-87df-48e6-99df-5b0003000e7f</guid><dc:creator>Jared</dc:creator><description>&lt;p&gt;I&amp;#39;m finding some related issues to using easyDMA / PPI with multiple devices on the same TWI bus (different problem with the same project).&amp;nbsp; From &lt;a href="https://devzone.nordicsemi.com/f/nordic-q-a/35359/2-devices-on-a-single-twi-instance-ppi"&gt;this&amp;nbsp;thread&lt;/a&gt;&amp;nbsp;I was thinking that I could use PPI with two slaves on one bus and just know that the RAM buffer would have alternating data, but the transfer sequence update (to update the slave address) blows away the RAM buffer, so I never get more than one sample of data in the buffer.&amp;nbsp; Is there a way to implement this that doesn&amp;#39;t involve reloading the transfer sequence?&amp;nbsp; I can put this on a different ticket if you prefer, but I was suspecting that there may be enough in common to keep these issues together.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: PPI on TWI instance 1 not working</title><link>https://devzone.nordicsemi.com/thread/254272?ContentTypeID=1</link><pubDate>Mon, 24 Feb 2020 20:48:22 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:010a5a55-a727-4ac9-9382-6c41c72191ad</guid><dc:creator>Jared</dc:creator><description>&lt;p&gt;Thank you for your help.&amp;nbsp; Please let me know if you have any questions.&amp;nbsp; I can give you the quick overview: TWI0 is used for comms to an A/D converter (via the easyDMA/PPI project code), D/A converter, and a digital rheostat.&amp;nbsp; The DAC acts as a current source (write a value, it sets a drive current to one of several LEDs).&amp;nbsp; The DAC writes are scheduled from an interrupt and don&amp;#39;t require easyDMA.&amp;nbsp; TWI1 is used for an accelerometer, which has a different data width (6 bytes vs 2 bytes for the ADC).&amp;nbsp; The digital rheostat is just written to once during initialization, which works fine.&amp;nbsp; The tx/rx&amp;nbsp;to the accelerometer during init also works fine.&amp;nbsp; Other significant project details include the SoftDevice 140 v6.1.0 and BLE comms that are working fine There are a lot of details I could go into - please let me know if you have any questions.&amp;nbsp; Apologies for the sloppiness of code at this stage in evaluation.&amp;nbsp; Thanks.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: PPI on TWI instance 1 not working</title><link>https://devzone.nordicsemi.com/thread/254271?ContentTypeID=1</link><pubDate>Mon, 24 Feb 2020 16:36:17 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:cec44a38-3cc3-4c30-86e8-d7b59a6be1f7</guid><dc:creator>J&amp;#248;rgen Holmefjord</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;There should not be any issues with doing this for two TWI peripherals, as long as you have the available peripherals/resources that are needed to set this up. I have converted this case into a private one to allow you to upload the firmware.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Best regards,&lt;br /&gt;Jørgen&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>