<?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>Hard fault when spi msg receive during ble scanning.</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/12454/hard-fault-when-spi-msg-receive-during-ble-scanning</link><description>Hi, 
 I setup the nrf51 as in central mode and talking to an ARM Cortex mcu via spi bus with the NRF51 set to slave. The spi communication working fine, but when I star scanning and the ble event start coming in, I getting hardfault when I try to sent</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Thu, 10 Mar 2016 03:33:27 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/12454/hard-fault-when-spi-msg-receive-during-ble-scanning" /><item><title>RE: Hard fault when spi msg receive during ble scanning.</title><link>https://devzone.nordicsemi.com/thread/47165?ContentTypeID=1</link><pubDate>Thu, 10 Mar 2016 03:33:27 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:5e1b10df-93f1-4d78-a985-6a966ececd2d</guid><dc:creator>utrank00</dc:creator><description>&lt;p&gt;It&amp;#39;s my fault.  I have a logging break point at the spi interupts.  That&amp;#39;s enough to throw sd out of sync.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Hard fault when spi msg receive during ble scanning.</title><link>https://devzone.nordicsemi.com/thread/47164?ContentTypeID=1</link><pubDate>Wed, 09 Mar 2016 20:55:06 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:1ccdbfe0-dcaa-442d-8d0f-75121e0d1364</guid><dc:creator>utrank00</dc:creator><description>&lt;p&gt;No, I&amp;#39;m try to receive spi msg while ble event coming in from another MCU.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Hard fault when spi msg receive during ble scanning.</title><link>https://devzone.nordicsemi.com/thread/47163?ContentTypeID=1</link><pubDate>Wed, 09 Mar 2016 20:49:23 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:115df9dd-daf0-42ad-a151-a43ddd9e2493</guid><dc:creator>Susheel Nuguru</dc:creator><description>&lt;p&gt;So you are trying to send SPI message from BLE event handler?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Hard fault when spi msg receive during ble scanning.</title><link>https://devzone.nordicsemi.com/thread/47162?ContentTypeID=1</link><pubDate>Wed, 09 Mar 2016 20:27:24 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:0737c354-70b5-42bf-96c2-26998aa0d142</guid><dc:creator>utrank00</dc:creator><description>&lt;p&gt;I use the api function spi_slave_init() to set up my spi bus.  This function set IRQ priority to APP_IRQ_PRIORITY_LOW.&lt;/p&gt;
&lt;p&gt;My spi interupt handle is very simple, it just call spi_slave_buffers_set() when I got SPI_SLAVE_XFER_DONE.&lt;/p&gt;
&lt;p&gt;In my code, if scanning not running, then everything is ok.  After scan start, and ble events start coming in from the sd, when I try to sent the spi msg from the Cortex, the hard fault occurs.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Hard fault when spi msg receive during ble scanning.</title><link>https://devzone.nordicsemi.com/thread/47161?ContentTypeID=1</link><pubDate>Wed, 09 Mar 2016 19:44:57 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:db622c3b-e790-4065-8c2e-83ab6626f3c3</guid><dc:creator>Susheel Nuguru</dc:creator><description>&lt;p&gt;Did you set any priority of your SPI interrupt? if not then  it is set to default highest priority and that most probably will cause an assert in the softdevice because softdevice does not like anything else at the priority in which it will work.&lt;/p&gt;
&lt;p&gt;If you have SPI priority to APP_PRIORITY_HIGH, then it is OK to the softdevice but as soon as you make any SVC calls (calls to sd_xxxx functions) then it will hardfault. This seems to be more probable for me that your SPI interrupt priority is high and somewhere it makes sd_call (most probably enter critical section using softdevice API)&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>