llpm sample project not working correctly?

Hello,

I think llpm's sample project is wrong. Evaluation board is not supposed to be communicating.

To verify the defect, the value of the time variable is fixed. This time variable should be sent via the gatt latency service.

	/* Start sending the timestamp to its peer */
	while (default_conn) {
		uint32_t time = 1000000;

		err = bt_latency_request(&latency_client, &time, sizeof(time));
		if (err && err != -EALREADY) {
			printk("Latency failed (err %d)\n", err);
		}

		k_sleep(K_MSEC(200)); /* wait for latency response */

In addition, it also removes the formula in the callback. This is not always necessary, but it makes it easier to understand.

static void latency_response_handler(const void *buf, uint16_t len)
{
	uint32_t latency_time;

	if (len == sizeof(latency_time)) {
		/* compute how long the time spent */
		latency_time = *((uint32_t *)buf);
		uint32_t cycles_spent = latency_time;
		llpm_latency.latency =
			(uint32_t)k_cyc_to_ns_floor64(cycles_spent) / 2000;
	}
}

Build and run. Note that the other evaluation board will write an unmodified sample project.

Transmission Latency: 226403 (us), CRC mismatches: 0
Transmission Latency: 226403 (us), CRC mismatches: 0
Transmission Latency: 226403 (us), CRC mismatches: 0
Transmission Latency: 226403 (us), CRC mismatches: 0
Transmission Latency: 226403 (us), CRC mismatches: 0
Transmission Latency: 226403 (us), CRC mismatches: 0
Transmission Latency: 226403 (us), CRC mismatches: 0
Transmission Latency: 226403 (us), CRC mismatches: 0
Transmission Latency: 226403 (us), CRC mismatches: 0
Transmission Latency: 226403 (us), CRC mismatches: 0
Transmission Latency: 226403 (us), CRC mismatches: 0
Transmission Latency: 226403 (us), CRC mismatches: 0
Transmission Latency: 226403 (us), CRC mismatches: 0
Transmission Latency: 226403 (us), CRC mismatches: 0
Transmission Latency: 226403 (us), CRC mismatches: 0
Connection interval updated: LLPM (1 ms)
Transmission Latency: 226403 (us), CRC mismatches: 0
Transmission Latency: 226403 (us), CRC mismatches: 0
Transmission Latency: 226403 (us), CRC mismatches: 0
Transmission Latency: 226403 (us), CRC mismatches: 0
Transmission Latency: 226403 (us), CRC mismatches: 0
Transmission Latency: 226403 (us), CRC mismatches: 0

Then the firmware that has not been modified will show the fixed values. I believe this should appear on the other side's evaluation board, am I wrong?
So this evaluation board is not communicating, correct?
If my understanding is incorrect, please correct.

Best Regards,
Yoshihiro Goto

  • Yoshihiro-san,

    It looks like some thing is wrong with a fixed latency of 226403 seems a bit unlikely. Have you tested this on the latest sdk on nrf52840DK? I can try to run and see if I see the same behavior and come back to you with my observations.

  • Hello Susheel,

    Thanks for reply and sorry my explanation was not clear. Also, I'm using the latest SDK 2.9.0.

    > It looks like some thing is wrong with a fixed latency of 226403 seems a bit unlikely.

    This fixed value is rewritten to understand that the evaluation board is NOT communicating. It is by no means a defect or build error in the SDK, nor is the evaluation board broken. In other words, the LLPM sample projects appear to show each other's interval times. but are they not actually just displaying their own intervals?

    I also have a doubt about the sample project, the sample project does not define a callback to be used in the 'received_latency_request()' function in C:/ncs/v2.9.0/nrf/subsys/bluetooth/services/latency.c. How does this sample project extract incoming data? 

    There's one more thing that concerns me. Both central and peripheral are calling the same 'test_run()' function. But is it correct for the peripheral to call the 'bt_latency_request()' function using the 'latency_client' structure?

    https://docs.nordicsemi.com/bundle/ncs-latest/page/nrf/samples/bluetooth/llpm/README.html

    Best regards,
    Yoshihiro Goto.

  • Yoshihiro-san,

    I have not tried to test this on many different nrf52840DKs using nrf connect sdk 2.9.0 with the llpm sample and I get a sensible values at the terminal.

    What is it different between your and my setup?

  • Hello Susheel,

    The numbers displayed in the log are strange because I rewrote the source code, not a bug. And my apologize, I misunderstood the purpose of this sample project. Also I understood that the purpose of this sample project was to measure response times, not to send data.

    I was able to verify that the data is being sent with debug logging enabled. I also understood that it was not displaying the received data (nor setting up callbacks) because this is a project to measure response time.

    So if I want to use received data based on this sample project, I will set up a callback for received_latency_request(), right?

    Best Regards,
    Yoshihiro Goto

  • Yoshihiro-san,

    Yoshihiro Goto said:
    So if I want to use received data based on this sample project, I will set up a callback for received_latency_request(), right?

    Yes, you are right. Modify the source code to setup a callback function that processes the received data as needed.

Related