The radio_test application doesn't receive input on nrf52840 chip, while the echo_bot example does.

I encounter this problem:

The radio_test application works correctly on the official nrf52840dk board, but cannot receive input commands on my custom product board.

However, the echo_bot example works fine on the same custom board.

I tried adding the following configuration:

```conf

CONFIG_CONSOLE=y
CONFIG_SERIAL=y
CONFIG_UART_CONSOLE=y
CONFIG_SHELL_BACKEND_SERIAL=y

```

I also tried to disable hardware flow control in code:

```c

    nrf_uarte_hwfc_pins_disconnect(NRF_UART0);

```

I noticed that echo_bot doesn't disable hardware flow control but still works properly.

My product uses the nRF52840 chip connected through an external J-Link, and I'm using NCS v2.9.0.

Questions: What should I do? What configuration or code do I need to add to solve this problem?

  • I find the true problem, the following function execution failes. 

    ```c

    err = sys_notify_fetch_result(&clk_cli.notify, &res);

    ```

    I printed the err value and compare it with the offciail board's output. The err should be zero but on my custom board is -11.
    And I examined the function:
    ```c

    static inline int sys_notify_fetch_result(const struct sys_notify *notify,
    int *result)
    {
           __ASSERT_NO_MSG(notify != NULL);
           __ASSERT_NO_MSG(result != NULL);
          int rv = -EAGAIN;

          if (sys_notify_get_method(notify) == SYS_NOTIFY_METHOD_COMPLETED) {
               rv = 0;
              *result = notify->result;
         }

         return rv;
    }

    ```
    I found the `-EAGAIN` is `-11`, which means the condition `sys_notify_get_method(notify) == SYS_NOTIFY_METHOD_COMPLETED` is

    never satisfied.

  • But I haven't yet solved this problem. I lost track of this thread. Does anybody know the reason?

  • Wang, I just took this thread and I will try to look into it and comeback to you by tomorrow evening with my observations. Thanks for your patience.

  • Thank you, Nuguru. I am very glad to receive your reply. And I want to provide some addition details.
    The issue occurss in the clock_init function:

    static void clock_init(void)
    {
    	int err = 0;
    	int res = 0;
    
    	struct onoff_manager *clk_mgr;
    	struct onoff_client clk_cli;
    
    	clk_mgr = z_nrf_clock_control_get_onoff(CLOCK_CONTROL_NRF_SUBSYS_HF);
    	if (!clk_mgr) {
    		printk("Unable to get the Clock manager\n");
    		return;
    	}
    
    	sys_notify_init_spinwait(&clk_cli.notify);
    
    	err = onoff_request(clk_mgr, &clk_cli);
    	if (err < 0) {
    		printk("Clock request failed: %d\n", err);
    		return;
    	}
    
    	do {
    		err = sys_notify_fetch_result(&clk_cli.notify, &res);
    		if (!err && res) {
    			printk("Clock could not be started: %d\n", res);
    			return;
    		}
    	} while (err);
    	printk("Clock has started\n");
    }

    And I am debuggin tow board simultaneously to observe the different. I found the variable clk_cli.notify.flags will change its value from 1 to 0 on the official boards. However, on my custuom boards, it remains 1 after the onff_request call.

    The res variable behaves the same on both boards, always remaining zero.

    Thanks for looking into this issue.

  • I think I found the specific problem, I tried to install nRF5 SDK to run the radio test, and I dicovered it gets stuck at following code:

    /** @brief Function for configuring all peripherals used in this example.
     */
    static void clock_init(void)
    {
        // Start 64 MHz crystal oscillator.
        NRF_CLOCK->EVENTS_HFCLKSTARTED = 0;
        NRF_CLOCK->TASKS_HFCLKSTART    = 1;
    
        // Wait for the external oscillator to start up.
        while (NRF_CLOCK->EVENTS_HFCLKSTARTED == 0)
        {
            // Do nothing.
        }
    }

    I searched in the forums and saw many people get stuck here due to crystal issues.Since I have limited knowledge about hardware, I need to confirm whether this is a hardware issue about our board.Thanks everyone, especially Nugruru.

Related