cancel
Showing results for 
Search instead for 
Did you mean: 

Merging of FP-IND-PREDMNT1 [WIFI] with AMicArray_UltrasoundFFT application. Has anyone tried it before?

Chandrashekar C
Associate III

Hi All, I am trying to merge FP-IND-PREDMNT1 [WIFI] with AMicArray_UltrasoundFFT application. Has anyone tried it before?

Are there any suggestion or advice?

More importantly I need to know if this is possible? are there any limitations?

@Eleon BORLINI​ Please advice.

Thanks in advance.

Kind Regards

Chandrashekar C

1 ACCEPTED SOLUTION

Accepted Solutions

Hi @Eleon BORLINI​, Thanks for the response.

I figured out the issue, the adau1978 version is different in  FP-IND-PREDMNT1 [WIFI] and AMicArray_UltrasoundFFT.

FP-IND-PREDMNT1 [WIFI] version is older than AMicArray_UltrasoundFFT.

/**
******************************************************************************
* @file    adau1978.c
* @author  SRA - Central Labs
* @version V1.0.0
* @date    05-Jul-19
* @brief   ADAU1978 driver file
******************************************************************************
**/
 
/**
******************************************************************************
* @file    adau1978.c
* @author  SRA - Central Labs
* @version v1.0.1
* @date    03-Apr-2020
* @brief   ADAU1978 driver file
******************************************************************************
**/

I coped the entire adau1978 component from AMicArray_UltrasoundFFT to FP-IND-PREDMNT1 [WIFI], everything started working :-)

Thanks again :-)

Kind Regards

Chandrashekar C

View solution in original post

7 REPLIES 7
Eleon BORLINI
ST Employee

Hi @Chandrashekar C​ ,

I believe that there are two ways to do at least part of what you are asking.

First, you can acquire the raw data of all the onboard sensors, using the HS_Datalog example (please note you have to use the dedicated example you can find in \Utilities\HS_DataLog\cli_example, not the standard VCOM), and then calculate the FFT by your own, e.g. with a python script.

Second, you can use the Dashboard, DSH-PREDMNT, with the STWINKT1 + the WIFI module, and send both the vibration sensor FFT and the microphone FFT. The dashboard will display the two FFTs.

Btw, the target is to make more applications, merging the capabilities of both. For now, I would suggest you to start e.g. from the example in \Projects\WiFi_Connectivity and save in local the data sent to the dashboard.

-Eleon

Chandrashekar C
Associate III

@Eleon BORLINI​ Thanks for the suggestion. I shall try out and get back to you on this.

So you are suggesting to calculate FFT outside STWINKT1? Is this because of processing time or memory constraints?

Kind Regards

Chandrashekar C

Hi @Chandrashekar C​ ,

Basically yes, but it depends on your application: if you have to run fast tests, or you have to run multiple tasks at firmware level,, it is better to calculate it via Software and not in the STWINKT1 firmware.

Otherwise, if you need only some FFT parameters (e.g. the FFT peak and the frequency of this peak), you may run it on the board (maybe with a limited number of points) and manage only the key parameters.

-Eleon

Chandrashekar C
Associate III

Hi @Eleon BORLINI​ Thanks again for the inputs.

Currently, I am facing an issue with AMIC_Array, I have merged AMicArray_UltrasoundFFT with STWIN_PM_AWS.  

AMIC_Array works fine initially but once I pause the AMIC_Array and start again, it doesn't work :-(

I have added a new periodic OSTimer which pauses and starts the AMIC

osTimerId array_timer_id;
osTimerDef(ArrayTimer, startMicArray);
uint32_t  exec2;
  
// Create periodic timer
  exec2 = 2;
  array_timer_id = osTimerCreate(osTimer(ArrayTimer), osTimerPeriodic, &exec2);
 
  status = osTimerStart (array_timer_id, 5000);                // start timer
  if (status != osOK)  {
    while(1);// Timer could not be started
  }
 
static void startMicArray(void const *arg)
{
  if(bMicArray)
  {
	AMIC_ARRAY_Start();
	bMicArray = false;
  }
  else
  {
	AMIC_ARRAY_Stop();
	bMicArray = true;
  }
}
 
/**
* @brief System Clock Configuration
* @retval None
*/
void SystemClock_Config(void)
{
  RCC_OscInitTypeDef RCC_OscInitStruct = {0};
  RCC_ClkInitTypeDef RCC_ClkInitStruct = {0};
  RCC_PeriphCLKInitTypeDef PeriphClkInit = {0};
 
  /**Configure the main internal regulator output voltage
  */
  if (HAL_PWREx_ControlVoltageScaling(PWR_REGULATOR_VOLTAGE_SCALE1_BOOST) != HAL_OK)
  {
    Error_Handler();
  }
  /** Configure LSE Drive Capability
  */
  HAL_PWR_EnableBkUpAccess();
  __HAL_RCC_LSEDRIVE_CONFIG(RCC_LSEDRIVE_LOW);
  /**Initializes the CPU, AHB and APB busses clocks
  */
  RCC_OscInitStruct.OscillatorType = RCC_OSCILLATORTYPE_HSI48|RCC_OSCILLATORTYPE_HSE
    |RCC_OSCILLATORTYPE_LSE;
  RCC_OscInitStruct.HSEState = RCC_HSE_ON;
  RCC_OscInitStruct.LSEState = RCC_LSE_ON;
  RCC_OscInitStruct.HSI48State = RCC_HSI48_ON;
  RCC_OscInitStruct.PLL.PLLState = RCC_PLL_ON;
  RCC_OscInitStruct.PLL.PLLSource = RCC_PLLSOURCE_HSE;
  RCC_OscInitStruct.PLL.PLLM = 2;
  RCC_OscInitStruct.PLL.PLLN = 30;
  RCC_OscInitStruct.PLL.PLLP = RCC_PLLP_DIV2;
  RCC_OscInitStruct.PLL.PLLQ = RCC_PLLQ_DIV2;
  RCC_OscInitStruct.PLL.PLLR = RCC_PLLR_DIV2;
  if (HAL_RCC_OscConfig(&RCC_OscInitStruct) != HAL_OK)
  {
    Error_Handler();
  }
  /**Initializes the CPU, AHB and APB busses clocks
  */
  RCC_ClkInitStruct.ClockType = RCC_CLOCKTYPE_HCLK|RCC_CLOCKTYPE_SYSCLK
    |RCC_CLOCKTYPE_PCLK1|RCC_CLOCKTYPE_PCLK2;
  RCC_ClkInitStruct.SYSCLKSource = RCC_SYSCLKSOURCE_PLLCLK;
  RCC_ClkInitStruct.AHBCLKDivider = RCC_SYSCLK_DIV1;
  RCC_ClkInitStruct.APB1CLKDivider = RCC_HCLK_DIV1;
  RCC_ClkInitStruct.APB2CLKDivider = RCC_HCLK_DIV1;
 
  if (HAL_RCC_ClockConfig(&RCC_ClkInitStruct, FLASH_LATENCY_5) != HAL_OK)
  {
    Error_Handler();
  }
  PeriphClkInit.PeriphClockSelection = RCC_PERIPHCLK_RTC
  |RCC_PERIPHCLK_SAI1
   |RCC_PERIPHCLK_I2C2
    |RCC_PERIPHCLK_DFSDM1
	 |RCC_PERIPHCLK_USB
	  |RCC_PERIPHCLK_SDMMC1
       |RCC_PERIPHCLK_ADC
	    |RCC_PERIPHCLK_DFSDM1AUDIO;
  PeriphClkInit.I2c2ClockSelection = RCC_I2C2CLKSOURCE_PCLK1;
  PeriphClkInit.Sai1ClockSelection = RCC_SAI1CLKSOURCE_PLLSAI1;
  PeriphClkInit.AdcClockSelection = RCC_ADCCLKSOURCE_PLLSAI1;
  PeriphClkInit.Dfsdm1ClockSelection = RCC_DFSDM1CLKSOURCE_PCLK;
  PeriphClkInit.RTCClockSelection = RCC_RTCCLKSOURCE_LSE;
  PeriphClkInit.Dfsdm1AudioClockSelection = RCC_DFSDM1AUDIOCLKSOURCE_SAI1;
  PeriphClkInit.UsbClockSelection = RCC_USBCLKSOURCE_HSI48;
  PeriphClkInit.Sdmmc1ClockSelection = RCC_SDMMC1CLKSOURCE_PLLP;
  PeriphClkInit.PLLSAI1.PLLSAI1Source = RCC_PLLSOURCE_HSE;
  PeriphClkInit.PLLSAI1.PLLSAI1M = 5;
  PeriphClkInit.PLLSAI1.PLLSAI1N = 96;
  PeriphClkInit.PLLSAI1.PLLSAI1P = RCC_PLLP_DIV25;
  PeriphClkInit.PLLSAI1.PLLSAI1Q = RCC_PLLQ_DIV4;
  PeriphClkInit.PLLSAI1.PLLSAI1R = RCC_PLLR_DIV4;
  PeriphClkInit.PLLSAI1.PLLSAI1ClockOut = RCC_PLLSAI1_SAI1CLK|RCC_PLLSAI1_ADC1CLK;
  if (HAL_RCCEx_PeriphCLKConfig(&PeriphClkInit) != HAL_OK)
  {
    Error_Handler();
  }
 
    __HAL_RCC_PWR_CLK_ENABLE();
 
}

I can share the project with you, please let me know if you can help me with this?

Kind Regards

Chandrashekar C

Hi @Chandrashekar C​ ,

as you may have understood, the request is not trivial...

In order to better understand where the problem is, you should run the same test (software timer + periodical start / stop) in the original software where you copied AMicArray_UltrasoundFFT function.

In this way you'll be able to understand if it may be an issue related to the driver or if it is correlated to the application FP-IND-PREDMNT1 [WIFI], which is much more complicated than the driver. If the issue is in AMicArray_UltrasoundFFT, I'll try to redirect the question internally.

-Eleon

Hi @Eleon BORLINI​, Thanks for the response.

I figured out the issue, the adau1978 version is different in  FP-IND-PREDMNT1 [WIFI] and AMicArray_UltrasoundFFT.

FP-IND-PREDMNT1 [WIFI] version is older than AMicArray_UltrasoundFFT.

/**
******************************************************************************
* @file    adau1978.c
* @author  SRA - Central Labs
* @version V1.0.0
* @date    05-Jul-19
* @brief   ADAU1978 driver file
******************************************************************************
**/
 
/**
******************************************************************************
* @file    adau1978.c
* @author  SRA - Central Labs
* @version v1.0.1
* @date    03-Apr-2020
* @brief   ADAU1978 driver file
******************************************************************************
**/

I coped the entire adau1978 component from AMicArray_UltrasoundFFT to FP-IND-PREDMNT1 [WIFI], everything started working :-)

Thanks again :-)

Kind Regards

Chandrashekar C

Good job @Chandrashekar C​ !