<?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>Illegal use of the EPSR - uart fault</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/119916/illegal-use-of-the-epsr---uart-fault</link><description>Hi, 
 i have some code thats based off of the uart_async_adapter.c example code. I&amp;#39; m getting a `usage fault` which i&amp;#39;ve traced to uart_irq_handler. it happens when i try to send a single byte 7F over the uart. 
 the strange thing is that after that fault</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Wed, 02 Apr 2025 09:06:01 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/119916/illegal-use-of-the-epsr---uart-fault" /><item><title>RE: Illegal use of the EPSR - uart fault</title><link>https://devzone.nordicsemi.com/thread/530178?ContentTypeID=1</link><pubDate>Wed, 02 Apr 2025 09:06:01 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:2ffea8c0-6cec-41e4-9c11-cd069698023a</guid><dc:creator>Einar Thorsrud</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;I see. This is about where the callback function should be called via&amp;nbsp;user_callback(). Perhaps it is worth setting a breakpoint there and see if the function pointer (data-&amp;gt;user_callback) is valid?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Illegal use of the EPSR - uart fault</title><link>https://devzone.nordicsemi.com/thread/530175?ContentTypeID=1</link><pubDate>Wed, 02 Apr 2025 08:59:46 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:71713dc8-e96d-438f-b10a-ffe3975b5ba6</guid><dc:creator>michaelmac</dc:creator><description>&lt;p&gt;yeah seems so, thanks.&amp;nbsp;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;on the faulting instruction - this was what got me to the uart interrupt.&amp;nbsp; well,&amp;nbsp;first&amp;nbsp;using the addrline with r15/pc returned&amp;nbsp;&lt;/p&gt;
&lt;blockquote&gt;
&lt;p style="padding-left:30px;"&gt;&amp;#39;libsoftdevice_controller_s140_debug_soft__obfuscated.elf:?&amp;#39;&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;then i tried with&amp;nbsp;r14/lr instead and got&lt;/p&gt;
&lt;blockquote&gt;
&lt;p style="padding-left:30px;"&gt;uart_async_adapter.c:137&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;this is the &lt;code&gt;switch_rx_buffer() &lt;/code&gt;function -&amp;gt;&amp;nbsp;&lt;code&gt; notify_rx_buffer_req(dev)&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;Im not sure how to go about looking at the stack trace&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Illegal use of the EPSR - uart fault</title><link>https://devzone.nordicsemi.com/thread/529699?ContentTypeID=1</link><pubDate>Mon, 31 Mar 2025 08:11:08 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:c348c2fb-40e0-4fbc-8925-3ffbc1569d61</guid><dc:creator>Einar Thorsrud</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;Thank you for the epxlanation.&lt;/p&gt;
[quote user="michaelmac"]I got a fix which was to make sure the ST has its uart TX pin always set to output high in normal application mode[/quote]
&lt;p&gt;I see. This could make sense. The error you described in the initial post are related to UART Rx only, and is what you would see if there is an invalid UART character received (framing error). So if the nRF is receiving and the Tx pin from the other MCU is not driven, this means that the Rx pin is floating, and this is expected. Solving this by making sure the ST sets it&amp;#39;s Tx pin high when idle is the appropriate fix.&lt;/p&gt;
[quote user="michaelmac"]but would still be nice to know why the nRF cant handle that error gracefully and continue.[/quote]
&lt;p&gt;Yes, I am suprised that you get a fault at this point, as you should normally be able to recover from a UART error. I would start by checking the&amp;nbsp;Faulting instruction address (PC) from the error with addr2line to see where in your code this is? Can you learn anything else from debugging? What does the stack trace look like?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Illegal use of the EPSR - uart fault</title><link>https://devzone.nordicsemi.com/thread/529691?ContentTypeID=1</link><pubDate>Mon, 31 Mar 2025 07:34:47 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:5a10dcc3-a8db-4cdf-a9ed-60bd052712ad</guid><dc:creator>michaelmac</dc:creator><description>&lt;p&gt;Hi Einar,&lt;/p&gt;
&lt;p&gt;Thanks for the reply and apologies for the delay replying.&lt;/p&gt;
&lt;p&gt;&lt;br /&gt;For the single byte, no i mean from the nRF to the other MCU.&amp;nbsp; this is the basic structure:&amp;nbsp;&lt;/p&gt;
&lt;p&gt;| TABLET |&amp;lt;----- ble -----&amp;gt;| nRF MCU |&amp;lt;----- uart &amp;amp; spi -----&amp;gt;| ST MCU |&lt;/p&gt;
&lt;p&gt;&lt;br /&gt;Normally the ST and the nRF are communicating via spi, but for bootloading the ST uses a specific uart.&amp;nbsp; So we send a special cmd to restart into it bootloader, which then looks for an initial byte on its uart.&amp;nbsp;&amp;nbsp;Then the nrf can do the bootloading over uart.&lt;/p&gt;
&lt;p&gt;The issue seems to be that I&amp;#39;ve configured any unused pins to input high-z on the ST (including the uart tx pin). so when the ST resets itself to bootloader, this flicks that TX pin to output causing noise on the line which is picked up as the error.&lt;/p&gt;
&lt;p&gt;I got a fix which was to make sure the ST has its uart TX pin always set to output high in normal application mode, which has solved it. but would still be nice to know why the nRF cant handle that error gracefully and continue.&lt;/p&gt;
&lt;p&gt;will look into the HFXO as well.&lt;/p&gt;
&lt;p&gt;cheers!&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Illegal use of the EPSR - uart fault</title><link>https://devzone.nordicsemi.com/thread/528032?ContentTypeID=1</link><pubDate>Wed, 19 Mar 2025 14:27:26 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:48c10913-2e31-400f-a108-0d2852629a81</guid><dc:creator>Einar Thorsrud</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;The driver handles clearing of interrupts etc, and there is no high level API for that nor should it be neeeded. It would be good to understand a bit more about this issue first.&lt;/p&gt;
&lt;p&gt;You write that you try to send a byte over UART, do then mean to the nRF, so that it is receiving? I ask just to confirm, as a framing error or break error would be related to reception/input and that match the other informaiton here. Also, can you elaborate more on what you do and the configuration? Are you using flow control? If not, does flow control help?&lt;/p&gt;
&lt;p&gt;PS: Sometimes it can be a problem with UART fi you have a inaccurate HF clock, so it could be worth enabling the HFXO and seeing if that makes a difference (as mentionned&amp;nbsp;&lt;a href="https://devzone.nordicsemi.com/f/nordic-q-a/105906/how-to-enable-nrf52840-to-use-external-32mhz-crystal/456665"&gt;here&lt;/a&gt;).&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>