Announcements

Tip / Sign in to post questions, reply, level up, and achieve exciting badges. Know more

cross mob
tiendat
Level 2
Level 2
10 replies posted First like given 10 sign-ins

Greetings devs and community members,

I'm in the process of developing a compact radar sensor that involves connecting 4 independent #BGT60TR13c sensors to a single MCU (#STM32H7). The schematic design can be found in the attached image, where each radar sensor is connected to independent SPI and GPIO ports

Individually setting and reading registers for a single sensor poses no issues. However, a problem arises when attempting to read data from all 4 sensors in series. The reading of registers is incomplete, leading to a halt in sensor processing.

I'm reaching out for assistance in resolving this situation. How can I successfully read data from all 4 sensors using a single MCU? Additionally, I would appreciate feedback on whether my schematics are sound.

Thank you all for your valuable support.

tiendat_0-1700447511379.png

 

0 Likes
1 Solution
Deepa_V
Moderator
Moderator
Moderator
First comment on KBA 50 likes received 250 replies posted

Hi @tiendat , 

Regarding your application,

1. When you try to acquire information by connecting the radar in series, whether with the CS lines or otherwise, the on-time of the radar is definitely a significant parameter. Only one radar can be active at a time and that would be decided by the duration that you want to keep the radar on for which would mean that any targets that fall on the other radar FoV will be missed.

2. In case of acquiring information parallely, we're not sure the MCU that you're using is capable of multi-threading. Even if that's the case, since this scenario has not been tested from our end, we cannot ensure that the radar will perform as required.

And, we regret to inform you that we cannot test out each custom code at our end but we'll make a note of your application and try to implement an example code soon.

If your use-case is only detection of moving target, then I would suggest you to use BGT60LTR11AIP as four of the same in Autonomous mode has been successfully interfaced and tested at our end.

Also, I'd request you to try debugging with the Section 4 of the Datasheet. 

Hope this helps !

Best Regards,

Deepa

View solution in original post

0 Likes
13 Replies
lock attach
Attachments are accessible only for community members.
tiendat
Level 2
Level 2
10 replies posted First like given 10 sign-ins

Here is my main.c file for your reference.
Thank you very much 

0 Likes
Deepa_V
Moderator
Moderator
Moderator
First comment on KBA 50 likes received 250 replies posted

Hi @tiendat ,

Can you elaborate on your setup? How have you placed the Radars?

Best Regards,

Deepa

0 Likes
lock attach
Attachments are accessible only for community members.
tiendat
Level 2
Level 2
10 replies posted First like given 10 sign-ins

 

Dear @Deepa_V 

Please review the three functions provided below to gain insight into the sensor elaboration process. Furthermore, for additional reference, kindly examine the main.c file.

Concerning the physical placement of the sensors, please refer to the image below, illustrating the arrangement of the four sensors.

Best regards,

 

tiendat_1-1700463238496.png

 


void initRadar(int i)
{
	int32_t status;


	//////////////
	/*
	HAL_GPIO_WritePin(radarDevice[i].LDO_EN_Port, radarDevice[i].LDO_EN_Pin,GPIO_PIN_RESET);
	 osDelay(5); // Wait LDO stable

	HAL_GPIO_WritePin(radarDevice[i].RST_Port, radarDevice[i].RST_Pin,GPIO_PIN_RESET);
	osDelay(500);
	HAL_GPIO_WritePin(radarDevice[i].RST_Port, radarDevice[i].RST_Pin,GPIO_PIN_SET);
	HAL_GPIO_WritePin(radarDevice[i].SPI_CSN_Port, radarDevice[i].SPI_CSN_Pin, GPIO_PIN_SET);
	HAL_GPIO_WritePin(radarDevice[i].LDO_EN_Port, radarDevice[i].LDO_EN_Pin,GPIO_PIN_SET);


	device_type = -1;
	osDelay(10); // Wait LDO stable
	*/
	xensiv_bgt60trxx_hard_reset(&radarDevice[i]);
	osDelay(5); // Wait LDO stable

	xensiv_bgt60trxx_init(&radarDevice[i], false);
	osDelay(5); // Wait LDO stable
	//HAL_GPIO_WritePin(radarDevice[i].LED_Port, radarDevice[i].LED_Pin,GPIO_PIN_SET);
	systemReady = 1;
	status = xensiv_bgt60trxx_config(&radarDevice[i], register_list, XENSIV_BGT60TRXX_CONF_NUM_REGS);
	if (status != HAL_OK) {
		systemReady = 0;
	}
	//end of init xensiv_bgt60trxx_mtb_init
	//interrupt init
	xensiv_bgt60trxx_set_fifo_limit(&radarDevice[i],NUM_SAMPLES_PER_FRAME);
	//end interrupt init

	if (xensiv_bgt60trxx_start_frame(&radarDevice[i], true) != XENSIV_BGT60TRXX_STATUS_OK)
	{
		systemReady = 0;
	}
	//HAL_GPIO_WritePin(radarDevice[i].LED_Port, radarDevice[i].LED_Pin,GPIO_PIN_RESET);
}
void processRadar(xensiv_radar_presence_handle_t handle,int i)
{
	currentWorkingRadar = i;
	if (xensiv_bgt60trxx_get_fifo_data(i,bgt60_buffer,
														   NUM_SAMPLES_PER_FRAME) == XENSIV_BGT60TRXX_STATUS_OK)
	{
		//Data preprocessing
		uint16_t *bgt60_buffer_ptr = &bgt60_buffer[0];
		float32_t *frame_ptr = &frame[0];
		for (int32_t sample = 0; sample < NUM_SAMPLES_PER_FRAME; ++sample)
		{
			*frame_ptr++ = ((float32_t)(*bgt60_buffer_ptr++) / 4096.0F);
		}

		// calculate the average of the chirps first
		arm_fill_f32(0, avg_chirp, NUM_SAMPLES_PER_CHIRP);

		for (int chirp = 0; chirp < NUM_CHIRPS_PER_FRAME; chirp++)
		{
			arm_add_f32(avg_chirp, &frame[NUM_SAMPLES_PER_CHIRP * chirp], avg_chirp, NUM_SAMPLES_PER_CHIRP);
		}

		arm_scale_f32(avg_chirp, 1.0f / NUM_CHIRPS_PER_FRAME, avg_chirp, NUM_SAMPLES_PER_CHIRP);
		xensiv_radar_presence_process_frame(handle, frame, xTaskGetTickCount() * portTICK_PERIOD_MS);

	}else{
		//xensiv_bgt60trxx_soft_reset(&radarDevice[i],XENSIV_BGT60TRXX_RESET_FSM);
		//initRadar(i);
		// xensiv_bgt60trxx_config(&radarDevice[i], register_list, XENSIV_BGT60TRXX_CONF_NUM_REGS);
	}
}
void TestRadar()
{
	//uint8_t buffer[196];
	int32_t status;
	uint32_t chipid;
	xensiv_bgt60trxx_device_t device_type;
	uint32_t frame_idx = 0;
	uint16_t test_word = XENSIV_BGT60TRXX_INITIAL_TEST_WORD;
	uint32_t numError = 0;
	uint32_t numCorrect = 0;
	int i= 0;
	//bool isOk = true;
	xensiv_radar_presence_handle_t handle;
	static const xensiv_radar_presence_config_t default_config =
			{
				.bandwidth                         = 460E6,//61261804000 - 60238196000,//460E6,
				.num_samples_per_chirp             = XENSIV_BGT60TRXX_CONF_NUM_SAMPLES_PER_CHIRP,
				.micro_fft_decimation_enabled      = false,
				.micro_fft_size                    = 128,
				.macro_threshold                   = 0.5f,
				.micro_threshold                   = 12.0f,
				.min_range_bin                     = 1,
				.max_range_bin                     = 5,
				.macro_compare_interval_ms         = 100,//250,
				.macro_movement_validity_ms        = 500,//1000,
				.micro_movement_validity_ms        = 1000,//2000,//4000,
				.macro_movement_confirmations      = 0,// 0,
				.macro_trigger_range               = 1,
				.mode                              = XENSIV_RADAR_PRESENCE_MODE_MICRO_AND_MACRO,//XENSIV_RADAR_PRESENCE_MODE_MICRO_IF_MACRO,
				.macro_fft_bandpass_filter_enabled = false,
				.micro_movement_compare_idx       = 5
			};


	currentWorkingRadar = 0;

	initRadar(2);
	initRadar(0);


	initRadar(1);
	initRadar(3);
	xensiv_radar_presence_set_malloc_free(pvPortMalloc,vPortFree);

	if (xensiv_radar_presence_alloc(&handle, &default_config) != 0)
	{
		//CY_ASSERT(0);
		systemReady = 0;
	}
	//currentWorkingRadar = 0;
	xensiv_radar_presence_set_callback(handle, presence_detection_cb, NULL);
	systemReady = 1;
	//osDelay(1000);


	for (;;)
	{
		i = 3;
		//for (i=0;i<4;i++)
		{

			if (HAL_GPIO_ReadPin(radarDevice[i].IRQ_Port,radarDevice[i].IRQ_Pin) == GPIO_PIN_SET){
			//if (HAL_GPIO_ReadPin(Sensor4_IRQ_GPIO_Port,Sensor4_IRQ_Pin) == GPIO_PIN_SET){

				processRadar(handle,i);
				osDelay(100);
				//rd1 =0;
			}
		}
	}
}

 

 

0 Likes
Deepa_V
Moderator
Moderator
Moderator
First comment on KBA 50 likes received 250 replies posted

Hi @tiendat ,

Physically, the setup and the schematic looks fine. Looks like an issue with initialization. We're checking out the case at our end. Will soon get back to you. 

Best Regards,

Deepa

0 Likes

Dear @Deepa_V 
As we investigated, 
"XENSIV_BGT60TRXX_REG_GSR0_CLK_NUM_ERR_MSK" errors from here. 
The "REG_GSR0_CLK_NUM_ERR_MSK"  it might be a register related to clock errors.
Hope to get your answer soon, 
Thank you very much!

0 Likes
Deepa_V
Moderator
Moderator
Moderator
First comment on KBA 50 likes received 250 replies posted

Hi @tiendat

Can you please explain why you are using separate SPI lines for each sensor when you could have connected all on the same line and selected each sensor using the CS line? 

Best Regards,

Deepa

0 Likes

Dear @Deepa_V 
We chose to isolate the SPI lines to enable the concurrent operation of 4 radar sensors, all running in parallel. This setup not only boosts the system speed but is also supported by our selection of the STM32H7 series, known for its robust 550MHz clock speed.
Best regards, 
David

0 Likes
Deepa_V
Moderator
Moderator
Moderator
First comment on KBA 50 likes received 250 replies posted

Hi @tiendat ,

Are you trying to implement parallel operation by multi-threading? Is that supported in your selected microcontroller? 

Best Regards,

Deepa

0 Likes

Dear @Deepa_V 

I've been attempting to implement parallel operation using multi-threading, as well as running it in series. Unfortunately, neither method has proven successful at the moment. Interestingly, when I tried operating the sensors one by one, it worked seamlessly for all four. I encountered a halt in signal processing when initializing the sensor. "XENSIV_BGT60TRXX_REG_GSR0_CLK_NUM_ERR_MSK" errors

Best regards, 
David

0 Likes
Deepa_V
Moderator
Moderator
Moderator
First comment on KBA 50 likes received 250 replies posted

Hi @tiendat ,

Can you explain how you implemented in series? By using Chip Select and selecting each radar one after the other or is it some other way?

Also, Can you please try debugging with the Section 4 of the datasheet https://www.infineon.com/dgdl/Infineon-DS_BGT60TR13C-DataSheet-v02_46-EN.pdf?fileId=8ac78c8c7d718a49... and let us know the findings ?

Best Regards,

Deepa

0 Likes

Dear @Deepa_V 
I have made some changes to the implementation process using the IRQ pins of each radar to read data sequentially. Here is the example sequence:

Initialize radar (2)
Initialize radar (0)
Initialize radar (1)
Initialize radar (3)

After implementing this sequence, I was able to successfully read data from last inited  radar 3. However, radar 2, 0, and 1 return errors as mentioned previously.
"XENSIV_BGT60TRXX_REG_GSR0_CLK_NUM_ERR_MSK" errors is the error code when i follow section 4 of the datasheet you sent. 

Best regards
David

0 Likes
Deepa_V
Moderator
Moderator
Moderator
First comment on KBA 50 likes received 250 replies posted

Hi @tiendat , 

Regarding your application,

1. When you try to acquire information by connecting the radar in series, whether with the CS lines or otherwise, the on-time of the radar is definitely a significant parameter. Only one radar can be active at a time and that would be decided by the duration that you want to keep the radar on for which would mean that any targets that fall on the other radar FoV will be missed.

2. In case of acquiring information parallely, we're not sure the MCU that you're using is capable of multi-threading. Even if that's the case, since this scenario has not been tested from our end, we cannot ensure that the radar will perform as required.

And, we regret to inform you that we cannot test out each custom code at our end but we'll make a note of your application and try to implement an example code soon.

If your use-case is only detection of moving target, then I would suggest you to use BGT60LTR11AIP as four of the same in Autonomous mode has been successfully interfaced and tested at our end.

Also, I'd request you to try debugging with the Section 4 of the Datasheet. 

Hope this helps !

Best Regards,

Deepa

0 Likes

Dear @Deepa_V 

Thank you so much for your unwavering support. I'll be sure to keep you updated on how my code performs in the coming days. 
Also, i wish to have your code example soon. 

Best regards,

0 Likes