<?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>nrf_gpio_pin_set causes random MCU resets during Manual-CS SPI transactions</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/99881/nrf_gpio_pin_set-causes-random-mcu-resets-during-manual-cs-spi-transactions</link><description>I created a function, spi_read, that performs a SPI transaction to RAM, comprised of 400 chunks, each 96 bytes long. 
 The CS control is set to manual. 
 that function crashes every 5-30 runs, randomly, probably at the call to nrf_gpio_pin_set. 
 Please</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Wed, 24 May 2023 18:30:36 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/99881/nrf_gpio_pin_set-causes-random-mcu-resets-during-manual-cs-spi-transactions" /><item><title>RE: nrf_gpio_pin_set causes random MCU resets during Manual-CS SPI transactions</title><link>https://devzone.nordicsemi.com/thread/427325?ContentTypeID=1</link><pubDate>Wed, 24 May 2023 18:30:36 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:a8dc38af-0d8a-4bc8-9802-c855de88bb31</guid><dc:creator>Susheel Nuguru</dc:creator><description>&lt;p&gt;Great, Please let me know if this helps.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: nrf_gpio_pin_set causes random MCU resets during Manual-CS SPI transactions</title><link>https://devzone.nordicsemi.com/thread/427323?ContentTypeID=1</link><pubDate>Wed, 24 May 2023 17:45:38 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:0ec173cf-1d86-45aa-b1a3-2ed2fcb11e57</guid><dc:creator>kobyatom</dc:creator><description>&lt;p&gt;Thank you Susheel. I will forward this to our HW engineer.&amp;nbsp;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: nrf_gpio_pin_set causes random MCU resets during Manual-CS SPI transactions</title><link>https://devzone.nordicsemi.com/thread/427038?ContentTypeID=1</link><pubDate>Tue, 23 May 2023 19:05:03 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:c0cfa30d-ad64-4d3d-82ea-2dbd6f312c7c</guid><dc:creator>Susheel Nuguru</dc:creator><description>&lt;p&gt;Yaakov,&lt;/p&gt;
&lt;p&gt;One of my colleague saw some issue with RESETREAS when the reset is caused by&amp;nbsp;&lt;span&gt;&lt;span dir="ltr"&gt;too much decoupling on VDD (i.e. to much cap. load) which caused REG0 to become unstable that again led to POR. This POR bit seems to be not registered for some reason. Can you double check your schematics (or upload them here so that we can review them) to see if this is behavior is relevant&amp;nbsp;to you.&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: nrf_gpio_pin_set causes random MCU resets during Manual-CS SPI transactions</title><link>https://devzone.nordicsemi.com/thread/427034?ContentTypeID=1</link><pubDate>Tue, 23 May 2023 18:33:29 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:affe9b44-a777-4ea6-a3ff-3afe862bb153</guid><dc:creator>Susheel Nuguru</dc:creator><description>&lt;p&gt;Reset reason cannot be 0, unless you have a bootloader that is booting before your application does and that bootloader is clearing the reset reason.&amp;nbsp;&lt;/p&gt;
[quote user="kobyatom"]so maybe there is a power drop issue on my circuit, due to some contention on the SPI + CS lines[/quote]
&lt;p&gt;Even so you should be able to see the reset as a brownout reset in the register. It cannot read 0 unless some module cleared the register in the firmware&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: nrf_gpio_pin_set causes random MCU resets during Manual-CS SPI transactions</title><link>https://devzone.nordicsemi.com/thread/426759?ContentTypeID=1</link><pubDate>Tue, 23 May 2023 07:22:01 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:5896a338-afeb-42d0-b3ae-32bc8a1bb38e</guid><dc:creator>kobyatom</dc:creator><description>&lt;p&gt;anyway, reset_reas value is 0 on powerup...&lt;br /&gt;so maybe there is a power drop issue on my circuit, due to some contention on the SPI + CS lines.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: nrf_gpio_pin_set causes random MCU resets during Manual-CS SPI transactions</title><link>https://devzone.nordicsemi.com/thread/426737?ContentTypeID=1</link><pubDate>Tue, 23 May 2023 05:51:58 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:76aee975-5d98-49e6-8ca9-42b9539f7262</guid><dc:creator>kobyatom</dc:creator><description>&lt;p&gt;the SPI is read via APP_SCHED, not from the ISR.&lt;/p&gt;
&lt;p&gt;I don&amp;#39;t know how easy it will be to reproduce, since my ISR source is external - an Accelerometer that&amp;nbsp;generates an interrupt every 16 samples (each 6 bytes long), with a sample&amp;nbsp;rate of 3200 Hz (5 msec between interrupts).&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: nrf_gpio_pin_set causes random MCU resets during Manual-CS SPI transactions</title><link>https://devzone.nordicsemi.com/thread/426734?ContentTypeID=1</link><pubDate>Tue, 23 May 2023 05:24:21 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:05a3c7fc-4e91-44c2-8643-16927fa4dfab</guid><dc:creator>kobyatom</dc:creator><description>&lt;p&gt;thanks, I will try&amp;nbsp;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: nrf_gpio_pin_set causes random MCU resets during Manual-CS SPI transactions</title><link>https://devzone.nordicsemi.com/thread/426733?ContentTypeID=1</link><pubDate>Tue, 23 May 2023 05:22:18 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:7659e0dc-a9f6-4d5b-995a-4413f0c56b28</guid><dc:creator>Susheel Nuguru</dc:creator><description>&lt;p&gt;I have never seen before that the reset reasons reads 0 before clearing up the register. Can you help me reproduce your error. Maybe give me a simplistic project where I can see the same reset and same reset reason 0 as you see (when the delay is not added)&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: nrf_gpio_pin_set causes random MCU resets during Manual-CS SPI transactions</title><link>https://devzone.nordicsemi.com/thread/426731?ContentTypeID=1</link><pubDate>Tue, 23 May 2023 05:18:45 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:4fa8ec0d-835b-428a-9bf5-eaf2ca817937</guid><dc:creator>kobyatom</dc:creator><description>&lt;p&gt;we carefully implemented this reset-reason feature a few months ago, and verified it to work with reset reasons SREQ and RESETPIN.&lt;/p&gt;
&lt;p&gt;Here is the implementation:&lt;/p&gt;
&lt;p&gt;We have a static member that&amp;nbsp;gets the reset reason on init, from the RESETREAS reg&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="text"&gt;const uint32_t reset_reason = nrf_power_resetreas_get();    // Do before any other action https://devzone.nordicsemi.com/f/nordic-q-a/48446/how-to-detect-cause-of-reset&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;in main() we clear the resetreas register&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="text"&gt;nrf_power_resetreas_clear(NRF_POWER_RESETREAS_OFF_MASK);    // Clear this register, instead of the bootloader.&lt;/pre&gt;and later we print the previously saved reset reason&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="text"&gt;ATLOG_INFO(&amp;quot;reset_reason 0x%08x&amp;quot;, reset_reason);&lt;/pre&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: nrf_gpio_pin_set causes random MCU resets during Manual-CS SPI transactions</title><link>https://devzone.nordicsemi.com/thread/426729?ContentTypeID=1</link><pubDate>Tue, 23 May 2023 05:11:12 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:decd7c2d-7b43-489a-b67b-2a8efcd6714a</guid><dc:creator>Susheel Nuguru</dc:creator><description>&lt;p&gt;Are you executing the SPI read from the ISR? If so which interrupt priority is this?&lt;/p&gt;
[quote user="kobyatom"]&lt;p&gt;The reset reason is 0.&lt;/p&gt;
&lt;p&gt;(The reset read operations shows 1 after I press the reset button, so I believe it is working properly.)&lt;/p&gt;[/quote]
&lt;p&gt;If you read the &lt;a href="https://infocenter.nordicsemi.com/index.jsp?topic=%2Fps_nrf52840%2Fpower.html&amp;amp;cp=5_0_0_4_2_6_10&amp;amp;anchor=register.RESETREAS"&gt;RESETREAS&lt;/a&gt;&amp;nbsp;after the reset (do not read this register when you press the reset button, read after when the chip resets when you do not have delay added after nrf_gpio_pin_set) register.&lt;/p&gt;
&lt;p&gt;This register cannot read 0 after the MCU reset, as there should be some reason registered why the chip was reset. If you are reading this register as value 0, then something is not correct in how you are reading this register.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: nrf_gpio_pin_set causes random MCU resets during Manual-CS SPI transactions</title><link>https://devzone.nordicsemi.com/thread/426727?ContentTypeID=1</link><pubDate>Tue, 23 May 2023 04:55:53 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:fb87bee7-e3e2-4b8a-9987-26cf5e2d65cd</guid><dc:creator>kobyatom</dc:creator><description>&lt;p&gt;I will check the trigger for the 96-byte SPI transaction. It should happen every 5 msec, trigger an ISR that starts the SPI transaction.&lt;/p&gt;
&lt;p&gt;The SPI transaction should complete in 96 micro-seconds (8MHz clock), which is a lot quicker than the external ISR rate, but there might be delays in the execution that cause the SPI transaction to&amp;nbsp;not complete in time for the next interrupt.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: nrf_gpio_pin_set causes random MCU resets during Manual-CS SPI transactions</title><link>https://devzone.nordicsemi.com/thread/426723?ContentTypeID=1</link><pubDate>Tue, 23 May 2023 03:32:15 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:0f36161b-9d47-4019-abbf-75522d103ead</guid><dc:creator>kobyatom</dc:creator><description>&lt;p&gt;it might not be known why, but it is what happens nonetheless. Adding a 1 microsecond delay between SPI transactions, after CS being set to inactive, right before the next transaction begins and CS is set to active again, avoids the reset.&lt;/p&gt;
&lt;p&gt;The reset reason is 0.&lt;/p&gt;
&lt;p&gt;(The reset read operations shows 1 after I press the reset button, so I believe it is working properly.)&lt;/p&gt;
&lt;p&gt;The SPI configuration is:&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="text"&gt;        .conf =
        {
            .sck_pin = NRFX_SPIM_SCK_PIN,
            .mosi_pin = NRFX_SPIM_MOSI_PIN,
            .miso_pin = NRFX_SPIM_MISO_PIN,
            .ss_pin = NRFX_SPIM_PIN_NOT_USED,
            .ss_active_high = false,
            .irq_priority = NRFX_SPIM_DEFAULT_CONFIG_IRQ_PRIORITY,
            .orc = 0xFF,
            .frequency = NRF_SPIM_FREQ_8M,
            .mode = NRF_SPIM_MODE_0,
            .bit_order = NRF_SPIM_BIT_ORDER_MSB_FIRST,
            NRFX_SPIM_DEFAULT_EXTENDED_CONFIG
        },&lt;/pre&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: nrf_gpio_pin_set causes random MCU resets during Manual-CS SPI transactions</title><link>https://devzone.nordicsemi.com/thread/426688?ContentTypeID=1</link><pubDate>Mon, 22 May 2023 18:59:46 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:6f83c7c8-c477-4eaf-9b7b-06f5ff7f900a</guid><dc:creator>Susheel Nuguru</dc:creator><description>&lt;p&gt;I do not see how adding a delay after pin set avoids a reset. We first need to know the reset reason before we can try to understand the context of the reset. As discussed in &lt;a href="https://devzone.nordicsemi.com/f/nordic-q-a/48446/how-to-detect-cause-of-reset"&gt;this&lt;/a&gt; thread, try to see if you can read the reset reason register after the reset happens, so that we can debug this further.&lt;/p&gt;
&lt;p&gt;If this turns out to be a soft-reset, this the application error handler could most likely be a reason. But at this point, we cannot debug this further without knowing the reason reason.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: nrf_gpio_pin_set causes random MCU resets during Manual-CS SPI transactions</title><link>https://devzone.nordicsemi.com/thread/426246?ContentTypeID=1</link><pubDate>Fri, 19 May 2023 11:36:47 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:d5b140cb-b6ea-4f41-a676-d4279e0dc37c</guid><dc:creator>Menon</dc:creator><description>&lt;p&gt;Hello,&lt;br /&gt;I am sorry, but we are short staffed this week due to Public Holidays in Norway. We will be back on Monday 22nd and hope to be able to answer all incoming requests within a couple of days, depending on the backlog. I am sorry for the inconvenience.&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Best regards,&lt;br /&gt;Abhijith&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>