This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

a problem in "ACI_DEVICE_STANDBY"

hi. Im working with nrf8001 type c in a self-designed board and im using arduino library driver on github by nordic. my mcu is stm32 and i ported library to my mcu. when I debug my program i find that my program go to "ACI_DEVICE_STANDBY" case in aci loop and nrf respond me with "03 84 0F" . as i understand, it means that nrf will advertise in this state. but when i use a smartphone with android 4.4 and BLE enabled i cant see nrf8001 in nrf uart app that made by nordic in play store. and im using service.h in "hello world" project.(type c , internal 32768, external crystal 16 MHz). please help what problems may be exist im my project or what points I have to check again? thank you.

  • Hi. I set According the datasheet (1-16383 (0x3FFF) and 32 - 16384 (0x0020 to 0x4000)) and I use this code :

    lib_aci_connect(0/* in seconds : 0 means forever */, 0x0050 /* advertising interval 50ms*/);
    

    Although in some cases in nRFgo, I clear check box for "Maximum interval" and "minmum interval" and "supervision timeout" . and regenerate services.h, but nothing change.

    another question: in ACI Verification example code , I run code for 2 times with this differences :

    1. lib_aci_test(ACI_TEST_MODE_DTM_ACI);

    2)lib_aci_test(ACI_TEST_MODE_DTM_UART);

    and programs returns OK. but when i use "ACI_TEST_MODE_EXIT" as lib_aci_test parameter , program returns Error. note that I wrote ACI code for External Interrupt not POLLING. Is there any fault or I have to ignore this error, because I saw this comment in lib_aci_test declaration in lib_aci.h:

    /** @brief Sets the radio in test mode.
    *  @details This function sends a @c Test command to the radio. There are two
    *  Test modes available:
    *  - UART: DTM commands are received over UART.
    *  - ACI: DTM commands are received over ACI.
    *  The same command is used to exit the test mode When receiving
    *  a @c DeviceStartedEvent the radio has entered the new mode.
    *  @param enter_exit_test_mode Enter a Test mode, or exit Test mode.
    *  @return True if the transaction is successfully initiated.
    */
    bool lib_aci_test(aci_test_mode_change_t enter_exit_test_mode);
    
  • I don't really understand what you are doing, why would you get the same event repeatedly? That is it does make sense to get the transaction continue event while doing the setup. But you should only get the device started event once. If you only issue the connect command once you should only get the command response for this once as well, not repeatedly. Can you check what you are doing here? Are you clearing the interrupt correctly? are you getting this value from the spi or could it be laying in the buffer? Regardless it seams as if you are indeed advertising. What smartphone are you testing with? could you try with lightblue for iOS, or our master control panel for android to see if these apps sees your device?

    What error does the aci_test_mode_exit return?

  • hi. thank you. I will explain more to clear what I'm doing. You are right. I receive each event once and then clear interrupt flag. but why I say "for 2 times" , "forever" . Because of this:

    *I use uart to debug my code and I place uart transmitter function in :

    bool lib_aci_event_get(aci_state_t *aci_stat, hal_aci_evt_t *p_aci_evt_data)
    {
       bool status = false;
    
       status = hal_aci_tl_event_get((hal_aci_data_t *)p_aci_evt_data);
    
       HAL_UART_Transmit(&huart1, (uint8_t*)p_aci_evt_data, 8 , HAL_MAX_DELAY);
       HAL_Delay(100);
       p_aci_evt_data = 0;
       .
       .
       .
    

    whereas in while(1) in main function in main.cpp, "aci_loop()" is called forever, "lib_aci_event_get" then called forever and my uart sends packet to my PC. if external interrupt doesn't occur and queue (aci_queue_dequeue()) was empty, uart sends last packet that placed in queue. I wrote my received events that form, because I wanted show explicitly.

    *I use 2 type smartphone. one: iPhone6s and two: a htc android 4.4 kitkat and BLE Enabled.(I don't know whats exactly its name) and in both I run nRF uart app form nordic.(in app store and play store)

    *I recently bought DK. I cant reach that yet.

    *in aci verification layer in section "case ACI_EVT_ECHO:" there is a "if":

    if (0 != memcmp(&echo_data[0], &(aci_evt->params.echo.echo_data[0]), sizeof(echo_data)))
    {
          Serial.println(F("Error: Echo loop test failed. Verify the SPI connectivity on the PCB."));
    }
    else
     {
          Serial.println(F("Echo OK"));
     }
    

    as I know if my program go to first brace ("Error: Echo loop test failed. Verify the SPI connectivity on the PCB."), there is a fault and if go to second brace("Echo OK") , verification is OK. but i don' know in how many cases I have to run program. we can use each member of below enumeration as "lib_aci_test" parameter.

    typedef enum
    {
    ACI_TEST_MODE_DTM_UART    = 0x01,
    ACI_TEST_MODE_DTM_ACI     = 0x02,
    ACI_TEST_MODE_EXIT        = 0xFF
    
    } _aci_packed_ aci_test_mode_change_t;
    

    in two first, i get

    Serial.println(F("Echo OK"));
    

    and in last i get:

    Serial.println(F("Error: Echo loop test failed. Verify the SPI connectivity on the PCB."));
    
  • The transport layer verification project is created so that you can send some dummy data to verify it is echoed back again identical to the data you send. This means you should not use the test command once you have entered the verify program. Instead you should use lib_aci_echo_msg to send dummy data. It doesn't really matter if you enter test mode overt uart or ACI in this case. Note that if you want to send DTM test messages you should look at one of the DTM projects (there is one for ACI and one for UART).

  • Hi run_ar and David. my problem was resolved. in this interrupt, I redesigned a new PCB with IFA Antenna. now I can see my nrf8001 in smartphones and send and receive Data. thank you

    Mohsen

Related