<?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>TWI_XFER is returning NRF_Success but the Data NACK is received</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/50652/twi_xfer-is-returning-nrf_success-but-the-data-nack-is-received</link><description>HI, 
 I&amp;#39;m having a problem when I use the function nrf_drv_twi_xfer. The function returns the error code NRF_SUCCESS, but using the event handler I notice that I&amp;#39;m receiving DATA NACK and the receiving buffer is empty, I didn&amp;#39;t recieve a response from</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Fri, 09 Aug 2019 08:20:34 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/50652/twi_xfer-is-returning-nrf_success-but-the-data-nack-is-received" /><item><title>RE: TWI_XFER is returning NRF_Success but the Data NACK is received</title><link>https://devzone.nordicsemi.com/thread/203229?ContentTypeID=1</link><pubDate>Fri, 09 Aug 2019 08:20:34 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:ef5982d1-8ea3-4163-9373-3fac8131c6e1</guid><dc:creator>ovrebekk</dc:creator><description>&lt;p&gt;Hi&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Using a checksum is not something mandated by the TWI (I2C) specification, this is just something this particular device is doing. In other words, unless you can find a library written specifically for your device then this is something you will have to handle manually on top of the TWI API.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Most TWI devices don&amp;#39;t bother with checksums, but it makes sense that a module related to crypto would be more concerned about data integrity/corruption.&lt;/p&gt;
&lt;p&gt;Best regards&lt;br /&gt;Torbjørn&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: TWI_XFER is returning NRF_Success but the Data NACK is received</title><link>https://devzone.nordicsemi.com/thread/203151?ContentTypeID=1</link><pubDate>Thu, 08 Aug 2019 17:34:50 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:8bab5f59-c917-43c3-b8e9-e67144f06ec7</guid><dc:creator>Jumega90</dc:creator><description>&lt;p&gt;Hi Torbjorn,&lt;/p&gt;
&lt;p&gt;Yes, I&amp;#39;m assuming the same, that the crypto memory could NACK if the checksum is no correct.&lt;br /&gt;I was wondering if the TWI library from the SDK calculates this checksum and added when the functions nrf_drv_twi_tx, nrf_drv_twi_rx and nrf_drv_twi_xfer are used. I wondering this because with the other sensor that I&amp;#39;m using, I use the ...twi_tx and ...twi_rx functions and I don&amp;#39;t pass them the count byte neither the checksum bytes, I only pass the array with the info that I want to send and read. I was using the same logic even thought in the other datasheet didn&amp;#39;t mention the count byte and the checksum bytes. That&amp;#39;s a difference between the datasheets.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;So in summary my doubt here is if the TWI functions calculates the count and checksum bytes internally and added them when they send the message?&lt;/p&gt;
&lt;p&gt;I still gonna look for some code online that could help to calculate the cheksum of the message and try that option.&lt;/p&gt;
&lt;p&gt;Best regards,&lt;/p&gt;
&lt;p&gt;Julio&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: TWI_XFER is returning NRF_Success but the Data NACK is received</title><link>https://devzone.nordicsemi.com/thread/203092?ContentTypeID=1</link><pubDate>Thu, 08 Aug 2019 13:23:47 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:2e4cb335-a8d5-417b-95b1-ad2d3b4bc3c3</guid><dc:creator>ovrebekk</dc:creator><description>&lt;p&gt;Hi&lt;/p&gt;
&lt;p&gt;I assume the sensor might NACK the transaction if the checksum fails?&lt;/p&gt;
&lt;p&gt;I found the following section in the datasheet regarding the checksum:&lt;/p&gt;
&lt;p&gt;&lt;em&gt;&amp;quot;CRC-16 verification of the count and packet bytes. The CRC polynomial is 0x8005. The initial register value should be zero and after the last bit of the count and packet have been transmitted, the internal CRC register should have a value that matches the checksum bytes in the block. The first CRC byte transmitted (N-1) is the least-significant byte of the CRC value, so the last byte of the group is the most-significant byte of the CRC.&amp;quot;&lt;/em&gt;&lt;/p&gt;
&lt;p&gt;With some luck you might find some source code online showing how to use the sensor, if you don&amp;#39;t have a lot of experience implementing CRC algorithms ;)&lt;/p&gt;
&lt;p&gt;Best regards&lt;br /&gt;Torbjørn&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: TWI_XFER is returning NRF_Success but the Data NACK is received</title><link>https://devzone.nordicsemi.com/thread/202910?ContentTypeID=1</link><pubDate>Wed, 07 Aug 2019 17:40:43 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:6611e0e9-6f66-422c-be2d-0b7da6ff4cf9</guid><dc:creator>Jumega90</dc:creator><description>&lt;p&gt;Hi Torbjorn,&lt;/p&gt;
&lt;p&gt;I have try using two commands: Random and Read.&lt;/p&gt;
&lt;p&gt;This array is declared like this:&lt;/p&gt;
&lt;p style="padding-left:30px;"&gt;static uint8_t&amp;nbsp; tx_cryp[5];&lt;/p&gt;
&lt;p&gt;It has 5 elements, for the Read Command these are the 5 elements:&lt;/p&gt;
&lt;p style="padding-left:30px;"&gt;tx_cryp[0] = Command; //This value is 0x03.&amp;nbsp;&lt;br /&gt; tx_cryp[1] = Read; //This value is 0x02.&lt;br /&gt; tx_cryp[2] = 0x00U; //This means&amp;nbsp; I want to read 4 bytes from the &amp;quot;Configuration zone&amp;quot;.&lt;br /&gt; tx_cryp[3] = 0x00U;&lt;br /&gt; tx_cryp[4] = 0x03U; //This offset is just to read four bytes in block one.&lt;/p&gt;
&lt;p&gt;For the Random Command:&lt;/p&gt;
&lt;p style="padding-left:30px;"&gt;&lt;span&gt;tx_cryp[0] = Command; //This value is 0x03.&amp;nbsp;&lt;/span&gt;&lt;br /&gt;&lt;span&gt;tx_cryp[1] = Random; //This value is 0x1B.&lt;/span&gt;&lt;br /&gt;&lt;span&gt;tx_cryp[2] = 0x01U; //This means&amp;nbsp; I want to&amp;nbsp;generate a random number without updating the EEPROM seed.&lt;/span&gt;&lt;br /&gt;&lt;span&gt;tx_cryp[3] = 0x00U;&lt;/span&gt;&lt;br /&gt;&lt;span&gt;tx_cryp[4] = 0x00U;&amp;nbsp;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;I have also try adding more elements to the array. These elements were the number of bytes sent as the first element of the array and add two elements at the end that were the checksum of the message, but this was left in 0x00 both elements because I don&amp;#39;t know how to calculate this checksum.&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;I will use an oscilloscope to probe the signals and see at what moment the NACK is sent.&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;Thanks.&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;Best regards,&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;Julio&lt;/span&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: TWI_XFER is returning NRF_Success but the Data NACK is received</title><link>https://devzone.nordicsemi.com/thread/202873?ContentTypeID=1</link><pubDate>Wed, 07 Aug 2019 14:24:03 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:5f1aa978-b6b1-490d-be89-0c8b28e2e4d7</guid><dc:creator>ovrebekk</dc:creator><description>&lt;p&gt;Hi Julio&lt;/p&gt;
&lt;p&gt;What is the content of the data you are trying to send?&lt;/p&gt;
&lt;p&gt;IE the value of the tx_cryp array.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;I would suggest finding some tool to probe the signals, as this makes it a lot easier to debug interfacing issues like these.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Best regards&lt;br /&gt;Torbjørn&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: TWI_XFER is returning NRF_Success but the Data NACK is received</title><link>https://devzone.nordicsemi.com/thread/202686?ContentTypeID=1</link><pubDate>Tue, 06 Aug 2019 18:13:29 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:ea319f31-c470-4152-bce3-5e162f6ef72e</guid><dc:creator>Jumega90</dc:creator><description>&lt;p&gt;Hi Torbjorn,&lt;/p&gt;
&lt;p&gt;I&amp;#39;m using the SDK 15.3.0.&lt;/p&gt;
&lt;p&gt;The flags is set to&amp;nbsp;&lt;span&gt;NRF_DRV_TWI_FLAG_TX_NO_STOP.&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;No, I haven&amp;#39;t probed the bus to see which byte the slave is NACK-ing.&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;This is the link to the Crypto Memory datasheet.--&amp;gt;&amp;nbsp;&lt;/span&gt;&lt;a href="http://ww1.microchip.com/downloads/en/DeviceDoc/20005927A.pdf"&gt;http://ww1.microchip.com/downloads/en/DeviceDoc/20005927A.pdf&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;Thanks for your help.&lt;/p&gt;
&lt;p&gt;Best regards,&lt;/p&gt;
&lt;p&gt;Julio&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: TWI_XFER is returning NRF_Success but the Data NACK is received</title><link>https://devzone.nordicsemi.com/thread/202634?ContentTypeID=1</link><pubDate>Tue, 06 Aug 2019 13:04:35 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:db2e37a8-f9bd-4c09-abc9-723e796f8af5</guid><dc:creator>ovrebekk</dc:creator><description>&lt;p&gt;Hi&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Which version of the SDK are you using?&lt;/p&gt;
&lt;p&gt;What have you set the flags to when you call the xfer function?&lt;/p&gt;
&lt;p&gt;Have you probed the bus to see what is going on, and which byte the slave is NACK-ing?&lt;/p&gt;
&lt;p&gt;Could you send me a link to the Crypto Memory datasheet if you have one?&lt;/p&gt;
&lt;p&gt;Best regards&lt;br /&gt;Torbjørn&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>