ncs2.60 nRF52832 Transmitting sensor data using Mesh chat

Hi~~ Nordic Team!!

Our project is to read data from sensors and transmit it to a smartphone.
So, we are configuring it using Mesh chat, and like the Meshchat example, the chat program using Putty operates normally and random data is also transmitted.

However, by configuring a 200ms Timer,
char Test_buf[] = {0x11, 0x22, 0x33, 0x44, 0x55, 0x66, 0x77, 0x88, 0x00};
char *Dview = &Test_buf[0];

bt_mesh_chat_cli_private_message_send(&chat, addr, Dview);

void LED_sample_event(struct k_timer *timer_id){
 
   if(gCnt_LED == 0)
   {
		dk_set_led(DVIEW_TEST_LED, 0);
		gCnt_LED = 1;
   }
   else
   {
		dk_set_led(DVIEW_TEST_LED, 1);
		gCnt_LED = 0;
   }

	if(g_MeshChat == 1)
	{
   		Dview_cmd_private_message();
	}

   
}

char Test_buf[] = {0x11, 0x22, 0x33, 0x44, 0x55, 0x66, 0x77, 0x88, 0x00};
char *Dview = &Test_buf[0];

int Dview_cmd_private_message(void)
{
	uint16_t addr;
	int err;

	addr = 0x0001;

//	shell_print(shell, "<KJH>: *0x%04X* %s", addr, Dview);
	err = bt_mesh_chat_cli_private_message_send(&chat, addr, Dview);
	if (err) {
		LOG_WRN("Failed to publish message Dview 0: %d", err);
	}
	return 0;

}

I tried to send using the function, but the data is not sent and as shown below:

<err> fatal_error: Resetting system
This is happening.

If you have any suggestions or need to resolve this issue, please advise.

Parents
  • Hi

    Where are you calling and using this timer exactly, my guess would be that what's happening here is that you're interrupting a SoftDevice Controller (time critical) function in your application, that results in this fatal error. What exactly are you trying to achieve with this timer on your end?

    In order to debug this and find out what exactly is causing the fault you can check out the DevAcademy and NCS intermediate course which has a lesson on Debugging in NCS that should be helpful getting started with debugging on your end.

    Best regards,

    Simon

Reply
  • Hi

    Where are you calling and using this timer exactly, my guess would be that what's happening here is that you're interrupting a SoftDevice Controller (time critical) function in your application, that results in this fatal error. What exactly are you trying to achieve with this timer on your end?

    In order to debug this and find out what exactly is causing the fault you can check out the DevAcademy and NCS intermediate course which has a lesson on Debugging in NCS that should be helpful getting started with debugging on your end.

    Best regards,

    Simon

Children
  • Hi Simon

    I want to send sensor data to my smartphone periodically by configuring a 200ms timer without chatting with a communication program like Putty.
    I tried to run int bt_mesh_chat_cli_private_message_send(struct bt_mesh_chat_cli *chat, uint16_t addr, const uint8_t *msg)
    in the timer callback function. However, I guess that struct bt_mesh_chat_cli *chat was incorrectly transmitted or that the problem occurred because it was sent in the callback function.

    void LED_sample_event(struct k_timer *timer_id){
    	 
    		if(gCnt_LED == 0)
    	   {
    			dk_set_led(DVIEW_TEST_LED, 0);
    			gCnt_LED = 1;
    	   }
    	   else
    	   {
    			dk_set_led(DVIEW_TEST_LED, 1);
    			gCnt_LED = 0; 
    	   }
    	
    		if(g_MeshChat == 1)
    		{
    			Dview_cmd_private_message();
    		}
    	
    		gTimerflag = 1;
    	   
    	}
    	
    	
    	int main(void)
    	{
    		int err;
    	
    		printk("Initializing...\n");
    		dk_leds_init(); //JHKIM
    	
    	
    		err = bt_enable(bt_ready);
    		if (err) {
    			printk("Bluetooth init failed (err %d)\n", err);
    		}
    	
    		k_timer_init(&Dview_timer, LED_sample_event, NULL);
    		k_timer_start(&Dview_timer, K_MSEC(TIMER_INTERVAL_MSEC), K_MSEC(TIMER_INTERVAL_MSEC));
    	
    	
    	//===============================================
    		Dview_Power_hold_init();
    		dk_set_led(RUN_STATUS_LED, 1);
    	//===============================================
    	
    		return 0;
    	}

    In conclusion, is there a way to automatically send periodically without using 'chat private 0xc0001 88' in the communication program?

Related