<?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>nrf52832 SPIM0 events stopped stuck problem</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/40740/nrf52832-spim0-events-stopped-stuck-problem</link><description>Hi, 
 I want to read a IC register over SPI. 
 This is msp430 code,it works. Just 
 CS low 
 write address 
 write 0x00 
 CS high 
 
 I use SPIM, this is initialization 
 
 this is spi read function 
 
 I test it debug mode and the code stucks at while</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Tue, 27 Nov 2018 08:35:26 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/40740/nrf52832-spim0-events-stopped-stuck-problem" /><item><title>RE: nrf52832 SPIM0 events stopped stuck problem</title><link>https://devzone.nordicsemi.com/thread/159165?ContentTypeID=1</link><pubDate>Tue, 27 Nov 2018 08:35:26 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:1355cf54-24ac-4fe0-ab60-efe27f3ddfc2</guid><dc:creator>Berker</dc:creator><description>&lt;p&gt;BMX055 has 3 sensors inside. Acceleremoter,Gyro,Magnetometer. There are 3 different Chip Select.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;My mistake, Gyro CS was LOW!.(This means both ACC and GYRO&amp;nbsp;was active)&lt;/p&gt;
&lt;p&gt;Expected response for ACC:&amp;nbsp; &amp;nbsp; &amp;nbsp;1111 1010&lt;/p&gt;
&lt;p&gt;Expected response for GYRO:&amp;nbsp; 0000 1111&lt;/p&gt;
&lt;p&gt;Result on MISO&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;???? 1?1?&lt;/p&gt;
&lt;p&gt;If 2 sensors drive different bit values at the same, data collision occured and this results avarage value on MISO line.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;I set CS high at the start of the code:&lt;/p&gt;
&lt;p&gt;NRF_GPIO-&amp;gt;OUTSET = (1UL &amp;lt;&amp;lt; bmx_cs2);&lt;/p&gt;
&lt;p&gt;This maybe helpful for others.&lt;/p&gt;
&lt;p&gt;Thanks.&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: nrf52832 SPIM0 events stopped stuck problem</title><link>https://devzone.nordicsemi.com/thread/159113?ContentTypeID=1</link><pubDate>Mon, 26 Nov 2018 19:56:21 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:1cad36cc-fd71-497d-98e4-ce74edd5fbf6</guid><dc:creator>Berker</dc:creator><description>&lt;p&gt;Hi&amp;nbsp;&lt;a href="https://devzone.nordicsemi.com/members/martinbl"&gt;MartinBL&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;Slave device BMX055 IMU. The problem looks like pcb trace or SPI peripheral&amp;nbsp;registers&amp;nbsp;related.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;MISO from device&lt;/p&gt;
&lt;p&gt;&lt;img alt=" " src="https://devzone.nordicsemi.com/resized-image/__size/320x240/__key/communityserver-discussions-components-files/4/bmx_5F00_id.png" /&gt;&lt;/p&gt;
&lt;p&gt;There is a strange voltage on&amp;nbsp;MISO&amp;nbsp;line. I&amp;#39;m sure MOSI is correct.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;It should be byte1: 0x00 byte2:11111010&amp;nbsp;&lt;/p&gt;
&lt;p&gt;but byte2:????1?1?, there are uncertain values.&lt;/p&gt;
&lt;p&gt;I didn&amp;#39;t set SPI pins input or output,only set ChipSelect as output.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;What is the problem? Is it pcb trace related or what?&lt;/p&gt;
&lt;p&gt;Best Regards&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: nrf52832 SPIM0 events stopped stuck problem</title><link>https://devzone.nordicsemi.com/thread/158384?ContentTypeID=1</link><pubDate>Wed, 21 Nov 2018 12:05:11 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:37010ded-4ccf-462f-ae9a-4d79cb00af5f</guid><dc:creator>MartinBL</dc:creator><description>&lt;p&gt;Hi&lt;/p&gt;
&lt;p&gt;I don&amp;#39;t see why this shouldn&amp;#39;t work. You don&amp;#39;t need all those while loops though. while(NRF_SPIM0-&amp;gt;EVENTS_END == 0) should enough in your case.&lt;/p&gt;
&lt;p&gt;If you always get 0x00 it could a HW issue. Maybe you are using the wrong pins, the pins are shorted to ground, your slave isn&amp;#39;t powered on or not started, etc.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;If you have a logic analyzer or an oscilloscope it could be useful to see what goes on on the SPI bus.&amp;nbsp;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: nrf52832 SPIM0 events stopped stuck problem</title><link>https://devzone.nordicsemi.com/thread/158362?ContentTypeID=1</link><pubDate>Wed, 21 Nov 2018 10:32:44 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:1790c490-9cbf-450f-9026-2bbcff9e252e</guid><dc:creator>Berker</dc:creator><description>&lt;p&gt;I read datasheet of SPIM peripheral again.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;I changed read function code as&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="c_cpp"&gt;uint8_t spi_read(uint8_t addr)
{

  uint8_t tx_buf[2];
  uint8_t rx_buf[2];

  // SHORT ayarı yapılacak
  NRF_SPIM0-&amp;gt;SHORTS = SPIM_SHORTS_END_START_Msk;

  tx_buf[0] = addr;
  tx_buf[1] = 0x00;
  NRF_SPIM0-&amp;gt;TXD.MAXCNT = sizeof(tx_buf);
  NRF_SPIM0-&amp;gt;TXD.PTR = (uint32_t)&amp;amp;tx_buf[0];

  NRF_SPIM0-&amp;gt;RXD.MAXCNT = sizeof(rx_buf);
  NRF_SPIM0-&amp;gt;RXD.PTR = (uint32_t)&amp;amp;rx_buf[0];

  
  NRF_SPIM0-&amp;gt;TASKS_START = 1;
  while(NRF_SPIM0-&amp;gt;EVENTS_ENDTX == 0);
  while(NRF_SPIM0-&amp;gt;EVENTS_ENDRX == 0);
  while(NRF_SPIM0-&amp;gt;EVENTS_END == 0);
  NRF_SPIM0-&amp;gt;TASKS_STOP = 1;
  while (NRF_SPIM0-&amp;gt;EVENTS_STOPPED == 0);
  return rx_buf[1];

}&lt;/pre&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Now, there is no stuck in events_stopped line.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Also, datasheet says :&amp;nbsp;&amp;quot;The SPI master is a synchronous interface, and for every byte that is sent, a different byte will be received at&lt;br /&gt;the same time&amp;quot; this means&amp;nbsp;&lt;span&gt;simultaneously&amp;nbsp; as answer for my question.&amp;nbsp;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;But, i&amp;#39;m still wrong value,i get 0x00 rather than 0xFA.&amp;nbsp;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;Can anyone verify the code according to spi transfer diagram?&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;&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;Berker&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;&lt;/span&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>