libuarte and sdcard spi ?

Dear Members,

I run 3 devices,

GPS on libuarte1

LCD on SPI2

Sdcard on SPI 1,

I'm using ANT and softdevice 340,

When I run LCD and SDcard outside the main loop, it's working ok,

by the time it's inside the main loop, it crashes with libuarte1,

Code :

									nrf_libuarte_async_config_t nrf_libuarte_async_config1 = {
            .tx_pin     = SER_APP_TX_PIN,
            .rx_pin     = SER_APP_RX_PIN,
            .baudrate   = NRF_UARTE_BAUDRATE_9600, //originally 28 Sept 2021
					  //.baudrate   = NRF_UARTE_BAUDRATE_38400,
            .parity     = NRF_UARTE_PARITY_EXCLUDED,
            .hwfc       = NRF_UARTE_HWFC_DISABLED,
            .timeout_us = 1000,
            .int_prio   = APP_IRQ_PRIORITY_LOW
			      
    };
		err_code=nrf_libuarte_async_init(&libuarte1, &nrf_libuarte_async_config1, uart_event_handler1, (void *)&libuarte1);
 /******************SDCARD  Sequence****************/   
 
			 
						NRF_SPI2->ENABLE = 0; //ILI9341 off
		          nrf_delay_ms(100);
			        NRF_SPI1->ENABLE = 1; //SDcard on
								
								fatfs_example();
								nrf_delay_ms(100);
								
		  /******************SDCARD  Sequence****************/   					  					
            printf("\rRixtronix LAB GPS Query.... \r\n");		
						 nrf_delay_ms(2000);
						GPSNeo_Process();

Debug :

nfo> app: 
                                                                   

isting directory: /
                                                          

   9550  RIXTRO.TXT<info> app: Writing to file RIXTRO.TXT...
                 

nfo> app: 50 bytes written.
                                                  

nfo> app: LOOP Rixtronix LAB.


rror> app: SOFTDEVICE: ASSERTION FAILED
     

                                                


                                                                             

nfo> app: Support us by subscribing,thanks...
                                


                                                                             

nfo> app: Initializing disk 0 (SDC)...
                                       

nfo> app: Capacity: 30436 MB
                                                 

nfo> app: Mounting volume...
                                                 
<error> app: ERROR 0 [NRF_SUCCESS] at ..\..\..\..\..\..\..\..\components\librari

\libuarte\nrf_libuarte_async.c:230
                                           

 at: 0x0004877B
                                                              

rror> app: End of error report

Any ideas on resolving it ? thanks

Parents
  • How can I use :

    nrf_sdh_soc_evt_handler

    with flag and callback ? any examples in sdk ?

    Thanks

  • When it's not working :

    Error at

    <error> app: ERROR 0 [NRF_SUCCESS] at ..\..\..\..\..\..\..\..\components\librari

    \libuarte\nrf_libuarte_async.c:230

  • HI Jared,

    Thanks for the message,

    It's still crashed, looks like libuarte crashed with ANT sensors,

    I need a timer for each event, any suggestions on using timer ?

    Regards,

  • Hi Jared thanks for the info,

    How can I relate the timer with :

    NRF_SDH_ANT_OBSERVER(m_ant_observer, ANT_HRM_ANT_OBSERVER_PRIO,
                         ant_hrm_disp_evt_handler, &m_ant_hrm);

    ??

    I made :

    static void create_timers_ANT_HRM()
    {
        ret_code_t err_code;
        
        // Create timers ANT HRM
        err_code = app_timer_create(&m_repeated_timer_id_ANT_HRM,
                                    APP_TIMER_MODE_REPEATED,
                                    repeated_timer_handler_ANT_HRM);
        APP_ERROR_CHECK(err_code);
    }

    Thanks

  • Hi,

    I'm sorry for the late response. Jared is on vacation so I will take over the case. 

    Please let us know if you managed to solve the issue or not ?

    Please note that the call nrf_libuarte_async_rx_free() is used after you have done with processing the data. This call is to return the buffer to the library so that it can receive more data. 
    So it's the best if you can call the function after you process data, not by a periodically timer.  

  • ............

    Please note that the call nrf_libuarte_async_rx_free() is used after you have done with processing the data. This call is to return the buffer to the library so that it can receive more data. 
    So it's the best if you can call the function after you process data, not by a periodically timer.  

    ...............

    I put it on my callback, and it's crashed, I'm using simple timer state machine now and still crashed,

    The sequence :

    1 .

      case NRF_LIBUARTE_ASYNC_EVT_RX_DATA:
                       
                       GPS_CallBack(); //originally on 1 Dec 21 Rixtronix LAB

    2. in the call back :

    if(GPS.rxIndex < sizeof(GPS.rxBuffer)-2)
        {
            GPS.rxBuffer[GPS.rxIndex] = GPS.rxTmp; //originally
            
            GPS.rxIndex++;
            memcpy((void *)line_buffer_GPS, (void *)GPS.rxBuffer, GPS.rxIndex);
               
        }

      nrf_libuarte_async_rx_free(&libuarte1, (uint8_t *)&GPS.rxTmp, 1); //originally Rixtronix LAB

    ....

    it's the best if you can call the function after you process data, not by a periodically timer.  
      ....   

    3. GPS process :

    in main()

    if (GPS_flag_timer ==1)
                {//turn on LED
                        nrf_gpio_pin_set(15);
                    
                     GPSNeo_Process();

              }

    Do you reckon I put

      nrf_libuarte_async_rx_free(&libuarte1, (uint8_t *)&GPS.rxTmp, 1); //originally Rixtronix LAB

    at the end of GPSNeo_Process(); ?

    Thanks

Reply
  • ............

    Please note that the call nrf_libuarte_async_rx_free() is used after you have done with processing the data. This call is to return the buffer to the library so that it can receive more data. 
    So it's the best if you can call the function after you process data, not by a periodically timer.  

    ...............

    I put it on my callback, and it's crashed, I'm using simple timer state machine now and still crashed,

    The sequence :

    1 .

      case NRF_LIBUARTE_ASYNC_EVT_RX_DATA:
                       
                       GPS_CallBack(); //originally on 1 Dec 21 Rixtronix LAB

    2. in the call back :

    if(GPS.rxIndex < sizeof(GPS.rxBuffer)-2)
        {
            GPS.rxBuffer[GPS.rxIndex] = GPS.rxTmp; //originally
            
            GPS.rxIndex++;
            memcpy((void *)line_buffer_GPS, (void *)GPS.rxBuffer, GPS.rxIndex);
               
        }

      nrf_libuarte_async_rx_free(&libuarte1, (uint8_t *)&GPS.rxTmp, 1); //originally Rixtronix LAB

    ....

    it's the best if you can call the function after you process data, not by a periodically timer.  
      ....   

    3. GPS process :

    in main()

    if (GPS_flag_timer ==1)
                {//turn on LED
                        nrf_gpio_pin_set(15);
                    
                     GPSNeo_Process();

              }

    Do you reckon I put

      nrf_libuarte_async_rx_free(&libuarte1, (uint8_t *)&GPS.rxTmp, 1); //originally Rixtronix LAB

    at the end of GPSNeo_Process(); ?

    Thanks

Children
Related