<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>Kinetis Software Development Kit中的主题 Re: Posting semaphore from SPI IRQ crashes app</title>
    <link>https://community.nxp.com/t5/Kinetis-Software-Development-Kit/Posting-semaphore-from-SPI-IRQ-crashes-app/m-p/409389#M1802</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi &lt;SPAN style="color: #51626f; font-family: arial, helvetica, 'helvetica neue', verdana, sans-serif;"&gt;José,&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #51626f; font-family: arial, helvetica, 'helvetica neue', verdana, sans-serif;"&gt;Is this something that happens immediately on the first transfer or the transfer works for a while and then stops responding?&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #51626f; font-family: arial, helvetica, 'helvetica neue', verdana, sans-serif;"&gt;David&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Thu, 06 Aug 2015 13:45:44 GMT</pubDate>
    <dc:creator>davidtietz</dc:creator>
    <dc:date>2015-08-06T13:45:44Z</dc:date>
    <item>
      <title>Posting semaphore from SPI IRQ crashes app</title>
      <link>https://community.nxp.com/t5/Kinetis-Software-Development-Kit/Posting-semaphore-from-SPI-IRQ-crashes-app/m-p/409386#M1799</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi all,&lt;/P&gt;&lt;P style="min-height: 8pt; padding: 0px;"&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I am trying to develop a transport protocol over SPI to comunnicate a FRDM-KL27Z board (master) with a CC2640 from TI (slave).&lt;/P&gt;&lt;P style="min-height: 8pt; padding: 0px;"&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I added a callback call at the end of function SPI_DRV_MasterCompleteTransfer() in file fsl_spi_master_driver.c to inform my app when a SPI transfer is completed. The application launches a SPI write operation and then is waiting in a semaphore in its main loop.&lt;/P&gt;&lt;P style="min-height: 8pt; padding: 0px;"&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Once the SPI transfer is completed, the function SPI_DRV_MasterIRQHandler() is called, and this ends calling my callback function. From it, I call OSA_SemaPost(&amp;amp;app_main_sem), and this call makes my app crash.&lt;/P&gt;&lt;P style="min-height: 8pt; padding: 0px;"&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I use lwsemaphores in other parts of the program and they are working OK. Also, I have put a breakpoint before the post operation and everything seems ok with the semaphore.&lt;/P&gt;&lt;P style="min-height: 8pt; padding: 0px;"&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Any ideas or suggestions?&lt;/P&gt;&lt;P style="min-height: 8pt; padding: 0px;"&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank you very much&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 04 Aug 2015 21:29:04 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Kinetis-Software-Development-Kit/Posting-semaphore-from-SPI-IRQ-crashes-app/m-p/409386#M1799</guid>
      <dc:creator>joséantoniomart</dc:creator>
      <dc:date>2015-08-04T21:29:04Z</dc:date>
    </item>
    <item>
      <title>Re: Posting semaphore from SPI IRQ crashes app</title>
      <link>https://community.nxp.com/t5/Kinetis-Software-Development-Kit/Posting-semaphore-from-SPI-IRQ-crashes-app/m-p/409387#M1800</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello Jose,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I think maybe the reason is the lwsemaphores run quickly .&lt;/P&gt;&lt;P&gt;And could you show your code&amp;nbsp; about this process :&lt;/P&gt;&lt;P&gt;Once the SPI transfer is completed, the function SPI_DRV_MasterIRQHandler() is called, and this ends calling my callback function. From it, I call OSA_SemaPost(&amp;amp;app_main_sem),&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;And when app crash , what does it show ?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Hope it helps&lt;/P&gt;&lt;P&gt;Alice&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 05 Aug 2015 03:50:15 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Kinetis-Software-Development-Kit/Posting-semaphore-from-SPI-IRQ-crashes-app/m-p/409387#M1800</guid>
      <dc:creator>Alice_Yang</dc:creator>
      <dc:date>2015-08-05T03:50:15Z</dc:date>
    </item>
    <item>
      <title>Re: Posting semaphore from SPI IRQ crashes app</title>
      <link>https://community.nxp.com/t5/Kinetis-Software-Development-Kit/Posting-semaphore-from-SPI-IRQ-crashes-app/m-p/409388#M1801</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Alice,&lt;/P&gt;&lt;P&gt;Thank you very much for your interest and your quick response.&lt;/P&gt;&lt;P&gt;I'm sorry, but I think I don't understand the explanation "the lwsemaphores run quickly" and how can it affect in my case (I am novice developing in this platform).&lt;/P&gt;&lt;P&gt;On the other way, I can show anything when app crashes: how could I see anything? I can confirm the crash using breakpoints and also switching on/off the board's led (using different colors to debug). Could you suggest me any other tools or procedures to help me find what is happening? Any suggestions are welcome!.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The following are the relevant parts of my code for the named process (I can send you the code files you want, or even a zip with the complete project if you wish). These are the lines I have added in fsl_spi_master_driver.c:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp; // declare reference to callback&lt;/P&gt;&lt;P&gt;&amp;nbsp; spi_transfer_done_cb_t transfer_done_cb = NULL;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp; // public function to set callback&lt;/P&gt;&lt;P&gt;&amp;nbsp; void SPI_DRV_MasterSetTransferDoneCallback(spi_transfer_done_cb_t transfer_done)&lt;/P&gt;&lt;P&gt;&amp;nbsp; {&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; transfer_done_cb = transfer_done;&lt;/P&gt;&lt;P&gt;&amp;nbsp; }&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp; static void SPI_DRV_MasterCompleteTransfer(uint32_t instance)&lt;/P&gt;&lt;P&gt;&amp;nbsp; {&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; ...&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; ...&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; if (spiState-&amp;gt;isTransferBlocking)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; {&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; /* Signal the synchronous completion object */&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; OSA_SemaPost(&amp;amp;spiState-&amp;gt;irqSync);&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; // I added the following call to callback function at this point&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; if (transfer_done_cb)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; {&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; transfer_done_cb();&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;/P&gt;&lt;P&gt;&amp;nbsp; }&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;And this is the relevant code of my main file:&lt;/P&gt;&lt;P&gt;&lt;SPAN style="line-height: 1.5;"&gt;&amp;nbsp; ...&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp; // SW3 button interrupt used to request a SPI write operation&lt;/P&gt;&lt;P&gt;&amp;nbsp; static void MQX_PORTBCDE_IRQHandler(void);&lt;/P&gt;&lt;P&gt;&amp;nbsp; static void npi_app_tl_packet_parser(void);&lt;/P&gt;&lt;P&gt;&amp;nbsp; static void transfer_done_callback(void);&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp; static tl_cbs_t npi_app_tl_cbs = {&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; npi_app_tl_packet_parser,&lt;/P&gt;&lt;P&gt;&amp;nbsp; };&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp; void Main_task(uint32_t param);&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="line-height: 1.5;"&gt;&amp;nbsp; // The lower "Priority" field is, the higher is the actual priority.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp; const TASK_TEMPLATE_STRUCT&amp;nbsp; MQX_template_list[] = {&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; /* Task Index,&amp;nbsp;&amp;nbsp; Function,&amp;nbsp;&amp;nbsp; Stack,&amp;nbsp; Priority, Name,&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Attributes,&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Param, Time Slice */&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; { MAIN_TASK,&amp;nbsp; Main_task, 700,&amp;nbsp;&amp;nbsp; 20,&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; "main", MQX_AUTO_START_TASK, 0,&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 0 },&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; { 0 }&lt;/P&gt;&lt;P&gt;&amp;nbsp; };&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp; void Main_task(uint32_t param) {&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; hardware_init();&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; OSA_Init();&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; // SRDY / SW1 interrupt&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; switchPins[0].config.interrupt = kPortIntFallingEdge;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; // SW3 button interrupt&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; switchPins[1].config.interrupt = kPortIntFallingEdge;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; GPIO_DRV_Init(switchPins, ledPins);&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; GPIO_DRV_WritePinOutput(kGpioCSn, 1);&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; configure_spi_pins(SPI0_IDX);&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; // SW3 button interrupt&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; OSA_InstallIntHandler(PORTBCDE_IRQn, MQX_PORTBCDE_IRQHandler);&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; NVIC_SetPriority(PORTBCDE_IRQn, 6);&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; osa_status_t status = OSA_SemaCreate(&amp;amp;app_main_sem, 0);&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; if (status != kStatus_OSA_Success) {&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; printf("Error creating main app semaphore: %d\n", status);&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; return;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="line-height: 1.5;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; tl_init(&amp;amp;npi_app_tl_cbs, TRANSPORT_TX_DONE_EVT,&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; TRANSPORT_RX_EVT, SPI_SRDY_EVT);&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; SPI_DRV_MasterSetTransferDoneCallback(&amp;amp;transfer_done_callback);&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; for(;;) {&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; do {&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; status = OSA_SemaWait(&amp;amp;app_main_sem, OSA_WAIT_FOREVER);&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; } while(status == kStatus_OSA_Idle);&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; if (status != kStatus_OSA_Success) {&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; printf("Error: syncStatus: %d\n", status);&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; tl_handle_ISR_event();&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; if (events &amp;amp; SPI_START_WRITE_EVT) {&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; events &amp;amp;= ~SPI_START_WRITE_EVT;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; npi_app_write();&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;/P&gt;&lt;P&gt;&amp;nbsp; }&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp; static void MQX_PORTBCDE_IRQHandler(void) {&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; PORT_HAL_ClearPortIntFlag(PORTC_BASE_PTR);&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; events |= SPI_START_WRITE_EVT;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; OSA_SemaPost(&amp;amp;app_main_sem);&lt;/P&gt;&lt;P&gt;&amp;nbsp; }&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp; static void transfer_done_callback(void) {&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; // Post the event to the task thread.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; TX_DONE_ISR_EVENT_FLAG = transport_tx_done_event;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; // App crashes when calling this function&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; OSA_SemaPost(&amp;amp;app_main_sem);&lt;/P&gt;&lt;P&gt;&amp;nbsp; }&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;As you can guess from the code, I start the board, and then I use SW3 button interrupt to force a SPI write. This causes 270 bytes to be writed to the bus, and correctly received in the other side. The, when the SPI transfer is complete the transfer_done_cb() I have added is called.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;José Antonio Martínez&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 05 Aug 2015 15:19:44 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Kinetis-Software-Development-Kit/Posting-semaphore-from-SPI-IRQ-crashes-app/m-p/409388#M1801</guid>
      <dc:creator>joséantoniomart</dc:creator>
      <dc:date>2015-08-05T15:19:44Z</dc:date>
    </item>
    <item>
      <title>Re: Posting semaphore from SPI IRQ crashes app</title>
      <link>https://community.nxp.com/t5/Kinetis-Software-Development-Kit/Posting-semaphore-from-SPI-IRQ-crashes-app/m-p/409389#M1802</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi &lt;SPAN style="color: #51626f; font-family: arial, helvetica, 'helvetica neue', verdana, sans-serif;"&gt;José,&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #51626f; font-family: arial, helvetica, 'helvetica neue', verdana, sans-serif;"&gt;Is this something that happens immediately on the first transfer or the transfer works for a while and then stops responding?&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #51626f; font-family: arial, helvetica, 'helvetica neue', verdana, sans-serif;"&gt;David&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 06 Aug 2015 13:45:44 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Kinetis-Software-Development-Kit/Posting-semaphore-from-SPI-IRQ-crashes-app/m-p/409389#M1802</guid>
      <dc:creator>davidtietz</dc:creator>
      <dc:date>2015-08-06T13:45:44Z</dc:date>
    </item>
    <item>
      <title>Re: Posting semaphore from SPI IRQ crashes app</title>
      <link>https://community.nxp.com/t5/Kinetis-Software-Development-Kit/Posting-semaphore-from-SPI-IRQ-crashes-app/m-p/409390#M1803</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;&amp;lt;EDITED&amp;gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Hi David,&lt;/P&gt;&lt;P&gt;Thank you for your interest. It happens always after finishing first transfer (note however that our SPI transfer is composed of 270 bytes).&lt;/P&gt;&lt;P&gt;What I have found is that app crashes in _lwsem_post() function (in lwsem.c file), when trying to recover the main task's context from the context of the SPI ISR where this code is launched.&lt;/P&gt;&lt;P&gt;Specifically, it crashes on following line:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="line-height: 1.5;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; if ((sem_ptr-&amp;gt;VALUE &amp;gt;= 0) &amp;amp;&amp;amp; (_QUEUE_GET_SIZE(&amp;amp;sem_ptr-&amp;gt;TD_QUEUE)))&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; {&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; _QUEUE_DEQUEUE(&amp;amp;sem_ptr-&amp;gt;TD_QUEUE, td_ptr);&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; _BACKUP_POINTER(td_ptr, TD_STRUCT, AUX_QUEUE);&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; _TIME_DEQUEUE(td_ptr, kernel_data);&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; td_ptr-&amp;gt;INFO = 0; /* Signal that post is activating the task */&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; _TASK_READY(td_ptr, kernel_data);&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; _CHECK_RUN_SCHEDULER(); /* Let higher priority task run */ // &amp;lt;&amp;lt;&amp;lt;&amp;lt;&amp;lt;&amp;lt;&amp;lt;&amp;lt;&amp;lt;&amp;lt;&amp;lt;&amp;lt;&amp;lt;&amp;lt;&amp;lt;&amp;lt;&amp;lt;&amp;lt;&amp;lt;&amp;lt;&amp;lt; CRASHES HERE !!!!&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;/P&gt;&lt;P&gt;We continue investigating.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thank you very much!&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;José Antonio Martínez.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 06 Aug 2015 21:12:36 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Kinetis-Software-Development-Kit/Posting-semaphore-from-SPI-IRQ-crashes-app/m-p/409390#M1803</guid>
      <dc:creator>joséantoniomart</dc:creator>
      <dc:date>2015-08-06T21:12:36Z</dc:date>
    </item>
    <item>
      <title>Re: Posting semaphore from SPI IRQ crashes app</title>
      <link>https://community.nxp.com/t5/Kinetis-Software-Development-Kit/Posting-semaphore-from-SPI-IRQ-crashes-app/m-p/409391#M1804</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi &lt;SPAN style="color: #51626f; font-family: arial, helvetica, 'helvetica neue', verdana, sans-serif;"&gt;José&lt;/SPAN&gt;,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The reason I asked was I had seen an issue in MQX 4.0 where there appeared to be an unhandled interrupt ending up in the SPI RX ISR. This would cause the semaphore to decrement one extra count each time this happened. Eventually the semaphore would rollover and would lock up the system. This is the thread:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 11.0pt; font-family: 'Calibri','sans-serif'; color: #1f497d;"&gt;&lt;A _jive_internal="true" href="https://community.nxp.com/message/407549#407549"&gt;https://community.freescale.com/message/407549#407549&lt;/A&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;This doesn't sound like your problem though, so I don't know how much help I can be. Have you installed the unexpected ISR to see if you end up there on your crash? Just a thought.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;David&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 07 Aug 2015 12:29:12 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Kinetis-Software-Development-Kit/Posting-semaphore-from-SPI-IRQ-crashes-app/m-p/409391#M1804</guid>
      <dc:creator>davidtietz</dc:creator>
      <dc:date>2015-08-07T12:29:12Z</dc:date>
    </item>
    <item>
      <title>Re: Posting semaphore from SPI IRQ crashes app</title>
      <link>https://community.nxp.com/t5/Kinetis-Software-Development-Kit/Posting-semaphore-from-SPI-IRQ-crashes-app/m-p/409392#M1805</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi David,&lt;/P&gt;&lt;P&gt;I have taken a look to the thread you suggest (again), but I could not see anything directly related to my case. What I see is not the ISR being called more times than expected (at least when using breakpoints to debug), but the execution fails in any case (while the semaphore seems to be OK, and it (I refer now to the option under MQX menu in KDS) shows an only task waiting on it as expected just before posting).&lt;/P&gt;&lt;P&gt;Please be patient with me, but I think I don't understand what you mean with "installed the unexpected ISR". Could you explain me in more detail?.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;By the way, could you give me any clue about a tool or&amp;nbsp; procedure to "know what is happening" when app seems to crash? I don't know any way to see any kernel messages or similar that inform about the problem.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thank you very much.&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;José Antonio Martínez.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 07 Aug 2015 20:10:10 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Kinetis-Software-Development-Kit/Posting-semaphore-from-SPI-IRQ-crashes-app/m-p/409392#M1805</guid>
      <dc:creator>joséantoniomart</dc:creator>
      <dc:date>2015-08-07T20:10:10Z</dc:date>
    </item>
    <item>
      <title>Re: Posting semaphore from SPI IRQ crashes app</title>
      <link>https://community.nxp.com/t5/Kinetis-Software-Development-Kit/Posting-semaphore-from-SPI-IRQ-crashes-app/m-p/409393#M1806</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello David,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;When you not use the lwsemaphores , does it can work well ?&lt;/P&gt;&lt;P&gt;Which IDE do you use ? And when it crash,&amp;nbsp; please screenshot the window of your IDE ?&lt;/P&gt;&lt;P&gt;And after i checked your code , it hard to fund the problem , could you send your project to me , and tell me your IDE and the version.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;BR&lt;/P&gt;&lt;P&gt;Alice&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 10 Aug 2015 10:43:15 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Kinetis-Software-Development-Kit/Posting-semaphore-from-SPI-IRQ-crashes-app/m-p/409393#M1806</guid>
      <dc:creator>Alice_Yang</dc:creator>
      <dc:date>2015-08-10T10:43:15Z</dc:date>
    </item>
    <item>
      <title>Re: Posting semaphore from SPI IRQ crashes app</title>
      <link>https://community.nxp.com/t5/Kinetis-Software-Development-Kit/Posting-semaphore-from-SPI-IRQ-crashes-app/m-p/409394#M1807</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Alice,&lt;/P&gt;&lt;P&gt;I think you are referring to me (when you say "Hello David" by error) isn't it?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Well, these are the details of our environment:&lt;/P&gt;&lt;UL&gt;&lt;LI&gt;HW: evaluation board FRDM-KL27Z&lt;/LI&gt;&lt;LI&gt;IDE: KDS 3.0.0 (running on Windows 10)&lt;/LI&gt;&lt;LI&gt;KSDK 1.2.0: so we use SPI drivers of MQX for KSDK. Specifically, our board act as a master, so we use "fsl_spi_master_driver.c"&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;In response to your other questions:&lt;/P&gt;&lt;UL&gt;&lt;LI&gt;The project works normally if we don't use semaphores, but then, its functionallity changes. We are now investigating if it would work changin semaphores to use lwevents. I will keep you informed. By the way, I have seen this thread: &lt;A href="https://community.nxp.com/message/324682"&gt;_lwsem_post problem on 32Bit SPI slave ISR  &lt;/A&gt; It seems a similar problem, and for that case there was no solution reported. However it seems that lwevents worked where semaphores don't.&lt;/LI&gt;&lt;LI&gt;I am goint to send you two things (I am preparing them now), as you requested:&lt;UL&gt;&lt;LI&gt;Screenshot when the program crashes.&lt;/LI&gt;&lt;LI&gt;A zipped file with my project. &lt;/LI&gt;&lt;/UL&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; However, note that I can't see anything weird in the IDE. Is a said in my last post I don't know a way to know "what is happening" or the "reason to failure". Everything I know, is that execution doesn't reach code after lwsempost() (for example if I put a breakpoint, or event if a toggle a LED). The IDE says that program is running, but I have loose control over it!.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thank you very much.&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;José Antonio Martínez&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 10 Aug 2015 14:18:53 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Kinetis-Software-Development-Kit/Posting-semaphore-from-SPI-IRQ-crashes-app/m-p/409394#M1807</guid>
      <dc:creator>joséantoniomart</dc:creator>
      <dc:date>2015-08-10T14:18:53Z</dc:date>
    </item>
    <item>
      <title>Re: Posting semaphore from SPI IRQ crashes app</title>
      <link>https://community.nxp.com/t5/Kinetis-Software-Development-Kit/Posting-semaphore-from-SPI-IRQ-crashes-app/m-p/409395#M1808</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Jose,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Alice brings up a good point. What exactly happens when your program crashes?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I have not tried any of this in KDS yet so that is my disclaimer. If you install _int_install_unexpected_isr(); in your main routine and if you are getting a hard fault or such during your crash you will end up in the unexpected isr handler. From there you can use this tutorial to trace back to the problem.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;A href="http://mcuoneclipse.com/2015/07/05/debugging-arm-cortex-m-hard-faults-with-gdb-custom-command/" title="http://mcuoneclipse.com/2015/07/05/debugging-arm-cortex-m-hard-faults-with-gdb-custom-command/"&gt;Debugging ARM Cortex-M Hard Faults with GDB Custom Command | MCU on Eclipse&lt;/A&gt; &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;This is of course assuming this is what happens. I am really just guessing.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 10 Aug 2015 14:39:00 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Kinetis-Software-Development-Kit/Posting-semaphore-from-SPI-IRQ-crashes-app/m-p/409395#M1808</guid>
      <dc:creator>davidtietz</dc:creator>
      <dc:date>2015-08-10T14:39:00Z</dc:date>
    </item>
    <item>
      <title>Re: Posting semaphore from SPI IRQ crashes app</title>
      <link>https://community.nxp.com/t5/Kinetis-Software-Development-Kit/Posting-semaphore-from-SPI-IRQ-crashes-app/m-p/409396#M1809</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi David,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thank you very much for your response and your clear explanations. I was not aware of this issue. I am going to test it now and will keep you inform about the results.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks&amp;nbsp; a lot for your help.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;José Antonio Martínez.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 10 Aug 2015 17:11:27 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Kinetis-Software-Development-Kit/Posting-semaphore-from-SPI-IRQ-crashes-app/m-p/409396#M1809</guid>
      <dc:creator>joséantoniomart</dc:creator>
      <dc:date>2015-08-10T17:11:27Z</dc:date>
    </item>
    <item>
      <title>Re: Posting semaphore from SPI IRQ crashes app</title>
      <link>https://community.nxp.com/t5/Kinetis-Software-Development-Kit/Posting-semaphore-from-SPI-IRQ-crashes-app/m-p/409397#M1810</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Jose,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;There are also some useful registers to look at when the crash occurs.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Take a look at the SystemControl registers (SCB). Some of them can tell you of issues that are causing problems.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 10 Aug 2015 19:47:19 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Kinetis-Software-Development-Kit/Posting-semaphore-from-SPI-IRQ-crashes-app/m-p/409397#M1810</guid>
      <dc:creator>davidtietz</dc:creator>
      <dc:date>2015-08-10T19:47:19Z</dc:date>
    </item>
    <item>
      <title>Re: Posting semaphore from SPI IRQ crashes app</title>
      <link>https://community.nxp.com/t5/Kinetis-Software-Development-Kit/Posting-semaphore-from-SPI-IRQ-crashes-app/m-p/409398#M1811</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Alice,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;In addition to previous responses, I just have send you the following files:&lt;/P&gt;&lt;UL&gt;&lt;LI&gt;A zip with my full project (it has some minor modifications so as the code can be tested using only the evaluation board FRDM-KL27Z).&lt;/LI&gt;&lt;LI&gt;The source files fsl_spi_master_driver.c and fsl_spi_master_driver.h: they include my minor changes to invoque a callback when SPI transaction finishes.&lt;/LI&gt;&lt;LI&gt;Three screen captures: corresponding to the moments before posting semaphore, after posting it (execution doesn't stop in breakpoint as expected), and pausing then execution to see what is executed.&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;To reproduce the problem, I do the following steps:&lt;/P&gt;&lt;OL&gt;&lt;LI&gt;Launch a debug session.&lt;/LI&gt;&lt;LI&gt;Put a breakpoint in the conflicting OSA_SemaPost() line (that is tl.c, line 67).&lt;/LI&gt;&lt;LI&gt;Pulse SW3 button in evaluation board: this causes a NPI write transaction to be started and so, execution stops in the breakpoint&lt;/LI&gt;&lt;LI&gt;Now, I can put another breakpoints, for example in lwsem.c in lines 569 and 583 (inside implementation of _lwsem_post()): using these breakpoints one can see that the first one is reached, but code never reachs the second one (after _CHECK_RUN_SCHEDULER()).&lt;/LI&gt;&lt;/OL&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I will be glad to help you or explain any point that is not clear. Also, I can send you any other file you can need. As for me, I am investigating following David's indications to try to know the ultimate cause of the problem. I will keep you informed.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thank you very much!&lt;/P&gt;&lt;P&gt;Regards&lt;/P&gt;&lt;P&gt;José Antonio Martínez&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 10 Aug 2015 22:45:28 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Kinetis-Software-Development-Kit/Posting-semaphore-from-SPI-IRQ-crashes-app/m-p/409398#M1811</guid>
      <dc:creator>joséantoniomart</dc:creator>
      <dc:date>2015-08-10T22:45:28Z</dc:date>
    </item>
    <item>
      <title>Re: Posting semaphore from SPI IRQ crashes app</title>
      <link>https://community.nxp.com/t5/Kinetis-Software-Development-Kit/Posting-semaphore-from-SPI-IRQ-crashes-app/m-p/409399#M1812</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Alice, David, (and everyone),&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Some more details while I contine investigating:&lt;/P&gt;&lt;OL&gt;&lt;LI&gt;I have added "_int_install_unexpected_isr()" in main, but it does not help (as far as I can see), nothing different appears on console. Maybe this is the expected result considering the following point:&lt;/LI&gt;&lt;LI&gt;I must clarify that the app does NOT crash. What is happening is that it stucks in _CHECK_RUN_SCHEDULER(). Specifically, when I pause the execution, it is always stopped at this point of dispatch.S file (function _sched_execute_scheduler_internal()) :&lt;/LI&gt;&lt;/OL&gt;&lt;P&gt;&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;&amp;nbsp; // r1 is 0 -&amp;gt; empty&lt;/P&gt;&lt;P&gt;ASM_LABEL(no_one_to_run)&lt;/P&gt;&lt;P&gt;&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;&amp;nbsp;&amp;nbsp; // wait for interrupt&lt;/P&gt;&lt;P&gt;&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;&amp;nbsp;&amp;nbsp; cpsie i&lt;/P&gt;&lt;P&gt;&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;&amp;nbsp;&amp;nbsp; wfi&lt;/P&gt;&lt;P&gt;&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;&amp;nbsp;&amp;nbsp; cpsid i&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&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;&amp;nbsp;&amp;nbsp; // TODO check r0, must be kernel data&lt;/P&gt;&lt;P&gt;&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;&amp;nbsp;&amp;nbsp; ldr r1, [r0, #KD_READY_Q_LIST]&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; // get first queue from ready list &amp;lt;&amp;lt;&amp;lt;&amp;lt;&amp;lt; EXECUTION ALWAYS STOPS HERE WHEN I PAUSE IT&lt;/P&gt;&lt;P&gt;&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;&amp;nbsp;&amp;nbsp; b find_noempty_que&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I am reading some threads about this problem. I have already test changing task's stack size (from 700 to 7000), and I am trying to clarify if everything is OK with interrupts, priority levels, etc..&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Any suggestions are, as always, welcome.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks a lot.&lt;/P&gt;&lt;P&gt;Regards.&lt;/P&gt;&lt;P&gt;José Antonio Martínez&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 11 Aug 2015 11:38:00 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Kinetis-Software-Development-Kit/Posting-semaphore-from-SPI-IRQ-crashes-app/m-p/409399#M1812</guid>
      <dc:creator>joséantoniomart</dc:creator>
      <dc:date>2015-08-11T11:38:00Z</dc:date>
    </item>
    <item>
      <title>Re: Posting semaphore from SPI IRQ crashes app</title>
      <link>https://community.nxp.com/t5/Kinetis-Software-Development-Kit/Posting-semaphore-from-SPI-IRQ-crashes-app/m-p/409400#M1813</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;&lt;SPAN style="color: #51626f; font-family: arial, helvetica, 'helvetica neue', verdana, sans-serif;"&gt;Hi Alice, David, (and everyone),&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #51626f; font-family: arial, helvetica, 'helvetica neue', verdana, sans-serif;"&gt;I am happy to say I think I have found the problem: reading the doc "Freescale MQX RTOS Introduction" I have realized that semaphores are used to synchronize tasks, and events can be used to synchronize tasks and also a ISR with a task. As you can see in my code, I have only one task, and I am using the semaphore to synchronize the task (there is a wait in its main loop) to the ISR that is called at the end of a SPI transaction. I have replaced the semaphore with an event, an everything seems to work correctly by now. I am going to do some tests more, but I would want&amp;nbsp; to express my gratitude for all your help and ideas.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #51626f; font-family: arial, helvetica, 'helvetica neue', verdana, sans-serif;"&gt;Thank you very much.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #51626f; font-family: arial, helvetica, 'helvetica neue', verdana, sans-serif;"&gt;Regards,&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #51626f; font-family: arial, helvetica, 'helvetica neue', verdana, sans-serif;"&gt;José Antonio Martínez.&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 11 Aug 2015 16:08:20 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Kinetis-Software-Development-Kit/Posting-semaphore-from-SPI-IRQ-crashes-app/m-p/409400#M1813</guid>
      <dc:creator>joséantoniomart</dc:creator>
      <dc:date>2015-08-11T16:08:20Z</dc:date>
    </item>
  </channel>
</rss>

