<?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>Workaround for erratum [220] when using FPU</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/115704/workaround-for-erratum-220-when-using-fpu</link><description>Hi 
 We are using the nRF52832 with the SoftDevice S132 V7.2.0. Recently, we had to enable the FPU whereby we have to re-evaluate the consequences of erratum 220. 
 According to this description , the SoftDevice V8.x should be used when the FPU is enabled</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Fri, 25 Oct 2024 14:14:06 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/115704/workaround-for-erratum-220-when-using-fpu" /><item><title>RE: Workaround for erratum [220] when using FPU</title><link>https://devzone.nordicsemi.com/thread/507974?ContentTypeID=1</link><pubDate>Fri, 25 Oct 2024 14:14:06 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:40c4c77f-c18b-44ab-820b-dcf181b2b77e</guid><dc:creator>Remo</dc:creator><description>&lt;p&gt;Hi Vidar&lt;/p&gt;
&lt;p&gt;Ok, solving this with a flag worked.&lt;/p&gt;
&lt;p&gt;Thanks again for all the help. It was very appreciated.&lt;/p&gt;
&lt;p&gt;Best regards&lt;/p&gt;
&lt;p&gt;Remo&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Workaround for erratum [220] when using FPU</title><link>https://devzone.nordicsemi.com/thread/507881?ContentTypeID=1</link><pubDate>Fri, 25 Oct 2024 09:14:34 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:94b8d6b8-dfde-4903-b201-08de46c3735a</guid><dc:creator>Vidar Berg</dc:creator><description>&lt;p&gt;Hi Remo,&lt;/p&gt;
&lt;p&gt;Detecting&amp;nbsp;the&amp;nbsp;&lt;span&gt;SD_EVT_IRQn is more tricky as it is a SW interrupt&amp;nbsp;that is set pending within the Softdevice ISRs to notify the app of a SD event. I suggest adding a volatile flag in the app to cover this.&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;Vidar&lt;/span&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Workaround for erratum [220] when using FPU</title><link>https://devzone.nordicsemi.com/thread/507871?ContentTypeID=1</link><pubDate>Fri, 25 Oct 2024 08:18:14 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:d14213d0-8740-4c8d-9e4a-0511d38aa80d</guid><dc:creator>Remo</dc:creator><description>&lt;p&gt;Hi Vidar&lt;/p&gt;
&lt;p&gt;I tested your function, and it seemed to worked with one exception: the function is not left when the SD_EVT_IRQn occurs. I mean the SD_EVT_IRQHandler is called, but the function app_evt_wait() is not left (assumingly because the SD_EVT_IRQn is automatically cleared). Do you have an idea how to solve this? How is this handled in sd_app_evt_wait()?&lt;/p&gt;
&lt;p&gt;Best regards&lt;/p&gt;
&lt;p&gt;Remo&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Workaround for erratum [220] when using FPU</title><link>https://devzone.nordicsemi.com/thread/507671?ContentTypeID=1</link><pubDate>Thu, 24 Oct 2024 05:43:32 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:89f7a8ce-99de-4bba-8255-0829f6a4a401</guid><dc:creator>Remo</dc:creator><description>&lt;p&gt;Hi Vidar&lt;/p&gt;
&lt;p&gt;Thank you very much for this function. We will test it on our side.&lt;/p&gt;
&lt;p&gt;Yes, we are using this function in a super loop in main.&lt;/p&gt;
&lt;p&gt;Best regards&lt;/p&gt;
&lt;p&gt;Remo&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Workaround for erratum [220] when using FPU</title><link>https://devzone.nordicsemi.com/thread/507547?ContentTypeID=1</link><pubDate>Wed, 23 Oct 2024 10:23:52 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:9f9a3ef5-1dd1-4cf9-a6c7-0ec2d5c433a5</guid><dc:creator>Vidar Berg</dc:creator><description>&lt;p&gt;Hi Remo,&lt;/p&gt;
&lt;p&gt;It&amp;#39;s correct that SDK 17.1.0 does not implement the errata 220 workaround.&amp;nbsp;&lt;/p&gt;
[quote user="Remosennhauser"]If we implement the loop ourselves, what does our application need to do when a SoftDevice-specific event occurred (e.g. RADIO)? Do we have to clear any pending IRQs/events, or can we simply go to sleep again?[/quote]
&lt;p&gt;The IRQ pending bit will be cleared as soon as the Softdevice has serviced the ISR, the same applies to application interrupts. I quickly tested this here by replacing the&amp;nbsp;sd_app_evt_wait() call in nrf_pwr_mgmt_run() with this&amp;nbsp;app_evt_wait() function I implemented:&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="c_cpp"&gt;/*
 * Enter system ON idle mode and return only when application level interrupts are triggered.
 * This function requires SEVONPEND to be enabled in the application.
 * (SCB-&amp;gt;SCR |= SCB_SCR_SEVONPEND_Msk;)
 */
static void app_evt_wait(void)
{
    uint32_t pending_irqs0;
    uint32_t pending_irqs1;

    do
    {
        __disable_irq();
        MWU_DISABLE();
        __WFE();
        __NOP();__NOP();__NOP();__NOP();
        pending_irqs0 = NVIC-&amp;gt;ISPR[0];
        pending_irqs1 = NVIC-&amp;gt;ISPR[1];
        __enable_irq();
        /* Note: mwu is enabled internally in the Softdevice during
         * forwarding of application interrutps
         */
        MWU_ENABLE();
    } while ((pending_irqs0 &amp;amp; __NRF_NVIC_APP_IRQS_0) == 0ul &amp;amp;&amp;amp;
             (pending_irqs1 &amp;amp; __NRF_NVIC_APP_IRQS_1) == 0ul);

}&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;Disclaimer: This function has not been thoroughly tested or reviewed by others.&lt;/p&gt;
[quote user="Remosennhauser"]easy because we have multiple wakeup-sources (rising edge on GPIO was only one example).[/quote]
&lt;p&gt;Do you&amp;nbsp;use the wait for event function in a superloop in main?&lt;/p&gt;
&lt;p&gt;Best regards,&lt;/p&gt;
&lt;p&gt;Vidar&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Workaround for erratum [220] when using FPU</title><link>https://devzone.nordicsemi.com/thread/507341?ContentTypeID=1</link><pubDate>Tue, 22 Oct 2024 11:59:13 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:f1a36186-6581-419f-9363-1878c8376080</guid><dc:creator>Remo</dc:creator><description>&lt;p&gt;Hi Vidar&lt;/p&gt;
&lt;p&gt;Unfortunately, it is not that easy because we have multiple wakeup-sources (rising edge on GPIO was only one example).&lt;/p&gt;
&lt;p&gt;In SDK V17.1.0, the wait for event loop doesn&amp;#39;t seem to have a workaround implemented. Or have I missed something?&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="text"&gt;    {
        // Wait for an event.
        __WFE();
        // Clear the internal event register.
        __SEV();
        __WFE();
    }&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;If we implement the loop ourselves, what does our application need to do when a SoftDevice-specific event occurred (e.g. RADIO)? Do we have to clear any pending IRQs/events, or can we simply go to sleep again?&lt;/p&gt;
&lt;p&gt;Best regards&lt;/p&gt;
&lt;p&gt;Remo&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Workaround for erratum [220] when using FPU</title><link>https://devzone.nordicsemi.com/thread/507325?ContentTypeID=1</link><pubDate>Tue, 22 Oct 2024 11:39:22 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:cc9dae1b-c7c1-4e19-919b-d25f4670e55c</guid><dc:creator>Vidar Berg</dc:creator><description>&lt;p&gt;Hi Remo,&lt;/p&gt;
&lt;p&gt;Can you set a volatile flag in the UART or GPIO ISR to signal the main loop when the interrupt has been triggered?&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="text"&gt;do 
{
    //TODO: use errata 220 WA to enter System ON
} while(&amp;lt;gpio interrupt triggered == 0&amp;gt;)

&lt;/pre&gt;&lt;/p&gt;
[quote userid="6356" url="~/f/nordic-q-a/115704/workaround-for-erratum-220-when-using-fpu/507321"]When I&amp;#39;ve understood the code in PWR_MGMT_FPU_SLEEP_PREPARE correctly, this is the workaround for erratum 87 and not 220. Or does this also fix erratum 220?[/quote]
&lt;p&gt;Correct, and the wait for event loop should include the workaround for both.&lt;/p&gt;
&lt;p&gt;Best regards,&lt;/p&gt;
&lt;p&gt;Vidar&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Workaround for erratum [220] when using FPU</title><link>https://devzone.nordicsemi.com/thread/507321?ContentTypeID=1</link><pubDate>Tue, 22 Oct 2024 11:33:57 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:0bb1e094-872e-4974-8508-66c22389240d</guid><dc:creator>Remo</dc:creator><description>&lt;p&gt;Hi Vidar&lt;/p&gt;
&lt;p&gt;Our application is controlled by commands from the UART interface, e.g. to &amp;quot;sleep&amp;quot; in system ON mode until a rising edge on a certain GPIO occurs. We relied on the behavior that the function sd_app_evt_wait() only returned when an application-based event occurred. Therefore, it would be great to have a workaround that behaves the same way as sd_app_evt_wait() did.&lt;/p&gt;
&lt;p&gt;When I&amp;#39;ve understood the code in PWR_MGMT_FPU_SLEEP_PREPARE correctly, this is the workaround for erratum 87 and not 220. Or does this also fix erratum 220?&lt;/p&gt;
&lt;p&gt;Best regards&lt;/p&gt;
&lt;p&gt;Remo&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Workaround for erratum [220] when using FPU</title><link>https://devzone.nordicsemi.com/thread/507314?ContentTypeID=1</link><pubDate>Tue, 22 Oct 2024 11:10:23 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:0ab4107e-6ed1-4437-ac0b-692bb96c8a60</guid><dc:creator>Vidar Berg</dc:creator><description>&lt;p&gt;Hi Remo,&lt;/p&gt;
&lt;p&gt;The implementation of sd_app_evt_wait() in the SoftDevice is more complex and differs from how it&amp;nbsp;you&amp;nbsp;would do it in an application. This is because it involves an SVCall and&amp;nbsp;defering of the __WFE() call from the interrupt context.&lt;/p&gt;
[quote user="Remosennhauser"]You&amp;#39;ve written that with option 1, we will also be woken up in case of &lt;span&gt;SoftDevice interrupts (RADIO, TIMER0, RTC0, ...).&lt;/span&gt;[/quote]
&lt;p&gt;Are you using&amp;nbsp;a supperloop, or are there&amp;nbsp;other reasons for why this is problematic in your application?&lt;/p&gt;
&lt;p&gt;Best regards,&lt;/p&gt;
&lt;p&gt;Vidar&lt;/p&gt;
&lt;p&gt;EDIT: forgot to add that nrf_pwr_mgmt_run() also handles clearing of FPU events with&amp;nbsp;PWR_MGMT_FPU_SLEEP_PREPARE().&amp;nbsp;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Workaround for erratum [220] when using FPU</title><link>https://devzone.nordicsemi.com/thread/507277?ContentTypeID=1</link><pubDate>Tue, 22 Oct 2024 08:22:52 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:c8bf9095-f1f2-4eaf-80ea-0d041ffd0628</guid><dc:creator>Remo</dc:creator><description>&lt;p&gt;Hi Vidar&lt;/p&gt;
&lt;p&gt;Thank you. You are right, option 1 sounds more reliable.&lt;/p&gt;
&lt;p&gt;You&amp;#39;ve written that with option 1, we will also be woken up in case of &lt;span&gt;SoftDevice interrupts (RADIO, TIMER0, RTC0, ...). Do you have a proposal how this function shall look like so that it behaves as sd_app_evt_wait()? Or would it be possible that you can share the code of sd_app_evt_wait() how it is implemented in SoftDevice V8.x.&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;Remo&lt;/span&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Workaround for erratum [220] when using FPU</title><link>https://devzone.nordicsemi.com/thread/507250?ContentTypeID=1</link><pubDate>Tue, 22 Oct 2024 07:28:32 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:911c0126-d717-4d97-a7dc-5de6ce2ab5d5</guid><dc:creator>Vidar Berg</dc:creator><description>&lt;p&gt;Hi Remo,&lt;/p&gt;
&lt;p&gt;Looking at this now, I think I would be more comfortable with option 1 and calling __WFE() from the app to avoid introducing potential new issues. As mentioned in my earlier response, the compiler may use floating point registers as general purpose registers. I&amp;#39;m not sure how common this is, but it might be more likely to&amp;nbsp;happen than the errata.&lt;/p&gt;
&lt;p&gt;Best regards,&lt;/p&gt;
&lt;p&gt;Vidar&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Workaround for erratum [220] when using FPU</title><link>https://devzone.nordicsemi.com/thread/507182?ContentTypeID=1</link><pubDate>Mon, 21 Oct 2024 14:43:51 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:9432da2f-c89e-4f20-b3e9-c27214a0a28f</guid><dc:creator>Remo</dc:creator><description>&lt;p&gt;Hi Vidar&lt;/p&gt;
&lt;p&gt;Thank you very much for the really fast answer! ;-)&lt;/p&gt;
&lt;p&gt;No, we have not yet experienced this erratum. We just went through the errata-sheet and wanted to ensure that we will not run into this issue in the future.&lt;/p&gt;
&lt;p&gt;Have I understood this correctly, that it is sufficient to disable the FPU context saving procedure by setting ASPEN=0 before calling sd_app_evt_wait()?&lt;/p&gt;
&lt;p&gt;Best regards&lt;/p&gt;
&lt;p&gt;Remo&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Workaround for erratum [220] when using FPU</title><link>https://devzone.nordicsemi.com/thread/507146?ContentTypeID=1</link><pubDate>Mon, 21 Oct 2024 13:05:21 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:b0096ea0-0ffe-403e-a6c6-60f03e04cfab</guid><dc:creator>Vidar Berg</dc:creator><description>&lt;p&gt;Hello Remo,&lt;/p&gt;
&lt;p&gt;It is possible to implement the workaround in the application code, please see this thread:&amp;nbsp;&amp;nbsp;&lt;a href="https://devzone.nordicsemi.com/f/nordic-q-a/84283/random-bad-instruction-faults-at-0x16274-with-softdevice-s132-version-7-0-1-sdk-16-0-0/350753"&gt;RE: Random bad instruction faults at 0x16274 with softdevice s132 version 7.0.1. SDK 16.0.0&lt;/a&gt;&amp;nbsp;. Have you experienced the errata in your current application?&amp;nbsp;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Best regards,&lt;/p&gt;
&lt;p&gt;Vidar&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>