cancel
Showing results for 
Search instead for 
Did you mean: 

hi im working on FDA903D AEK AUD D903V1 autodevkit, im trying to send information from an NXP MPCU5748G microcontroller through I2C AND I2S.

aturk.2
Associate II

i have set enables 1,2,3 and 4 as 1100 which is address 2 , but for some reason the speaker is not open and voltage is not passing through it which means i cant move on and give orders through i2c registers, can you please explain what the reason might be?

18 REPLIES 18

Mr max, im trying to follow the I2C register reset, but when i want to send some data to an address (for example address register 8) it gives me on my logic analyzer 0B0001000 + NACK, so i cant send data without the ack bit. do you know what could be possibly the mistake?

0693W00000UnVKtQAN.png

Dear Sir,

It is not easy to help you debug the communication of a microcontroller I do not know.

I can only try to give two general suggestions:

  1. Have you properly set the I2C protocol in the Microcontroller? Speed, Endianess, Start, ACK, Stop times, etc.?
  2. the I2C packet has to be formed according to the datasheet of the FDA903D if you want a response (page 59)0693W00000UnVkXQAV.pngThe packet is 24bits and not 8bits.

Finally, you should already have the source code in AutoDevKit, therefore you can copy from there how to properly prepare the i2C packet.

ok Mr max thanks for the support, do you have demo like the one you have sent that works on stm32f429i Discovery card?

Dear Sir,

The demo is written for SPC58 microcontrollers.

You are free to port it on STM32 if needed.

Regards,

AutoDevKit Team

Mr max, i have decided to use STM32F429ZI MCU from the f429 discovery card, do you have any demos that works with the FDA903D if not can you show me example codes so i can use it and built my own code? thank you

İ have to install the library on stm32 right?

Just take the driver of FDA903 from SPC58 and change the low-level calls to STM32. Just be careful that SPC58 is big endian while STM32 is little endian.

Mr max , i took the driver and inclluded it to my project, the code i wrote is like this:

my functions:

void AEK_903D_Init()

{

HAL_GPIO_WritePin(GPIOE, GPIO_PIN_8, GPIO_PIN_RESET);

HAL_GPIO_WritePin(GPIOE, GPIO_PIN_10, GPIO_PIN_RESET);

HAL_GPIO_WritePin(GPIOE, GPIO_PIN_12, GPIO_PIN_RESET);

HAL_GPIO_WritePin(GPIOE, GPIO_PIN_14, GPIO_PIN_RESET);

HAL_Delay(500);

HAL_GPIO_WritePin(GPIOE, GPIO_PIN_8, GPIO_PIN_RESET);

HAL_GPIO_WritePin(GPIOE, GPIO_PIN_10, GPIO_PIN_SET);

HAL_GPIO_WritePin(GPIOE, GPIO_PIN_12, GPIO_PIN_RESET);

HAL_GPIO_WritePin(GPIOE, GPIO_PIN_14, GPIO_PIN_RESET); // I2C adress is 0100 = 0xE0

}

uint16_t AEK_903D_SetDefaultRegisters()

{

HAL_StatusTypeDef status;

  uint8_t data[15];

  uint8_t play = 0B11100001;

  // Init: Turn IB registers into application default setting

data[0] = IB0_DEFAULT; // data[0] = 0x00;

  data[1] = IB1_DEFAULT; // data[1] = 0x00;

  data[2] = IB2_DEFAULT; // data[2] = 0x00;

  data[3] = IB3_DEFAULT; // data[3] = 0x38;

  data[4] = IB4_DEFAULT; // data[4] = 0x00;

  data[5] = IB5_DEFAULT; // data[5] = 0x00;

  data[6] = IB6_DEFAULT; // data[6] = 0x00;

  data[7] = IB7_DEFAULT; // data[7] = 0x00;

  data[8] = IB8_DEFAULT; // data[8] = 0xC0;

  data[9] = IB9_DEFAULT; // data[9] = 0x00;

  data[10] = IB10_DEFAULT; // data[10] = 0x50;

  data[11] = IB11_DEFAULT; // data[11] = 0x30;

  data[12] = IB12_DEFAULT; // data[12] = 0x00;

  data[13] = IB13_DEFAULT; // data[13] = 0x20;

  data[14] = IB14_DEFAULT; // data[14] = 0x09;

  //return AEK_903D_Write_IB(dev, IB0, &data[0], 15); // IB14[0] = 1; FIRST bit

  status = HAL_I2C_Mem_Write(&hi2c1, 0xE0, IB8, 15, &play, 15, 100); // play is 11100001 which puts PWM on and plays

  if(HAL_OK == status)

  {

  HAL_GPIO_WritePin(GPIOG, GPIO_PIN_13, GPIO_PIN_SET);

  return 1;

  }

  return 0;

}

in my main:

int main(void)

{

 /* USER CODE BEGIN 1 */

//findF_Out(1250);

sample_dt = F_OUT/F_SAMPLE;

sample_N = F_SAMPLE/F_OUT;

 /* USER CODE END 1 */

 /* MCU Configuration--------------------------------------------------------*/

 /* Reset of all peripherals, Initializes the Flash interface and the Systick. */

 HAL_Init();

 /* USER CODE BEGIN Init */

 /* USER CODE END Init */

 /* Configure the system clock */

 SystemClock_Config();

 /* USER CODE BEGIN SysInit */

 /* USER CODE END SysInit */

 /* Initialize all configured peripherals */

 MX_GPIO_Init();

 MX_DMA_Init();

 MX_I2C1_Init();

 MX_I2S3_Init();

 MX_CAN1_Init();

 /* USER CODE BEGIN 2 */

 if( HAL_CAN_Start(&hcan1) != HAL_OK)

 {

 Error_Handler();

 }

// CAN notification

if(HAL_CAN_ActivateNotification(&hcan1, CAN_IT_RX_FIFO0_MSG_PENDING) != HAL_OK)

{

Error_Handler();

}

sample_dt = F_OUT/F_SAMPLE;

sample_N = F_SAMPLE/F_OUT;

 AEK_903D_Init();

 AEK_903D_SetDefaultRegisters();

 for(uint16_t i=0; i<sample_N; i++){

 mySinVal = sinf(i*2*PI*sample_dt);

 dataI2S[i*2]=(mySinVal+0)*8000;

 dataI2S[i*2+1]=(mySinVal+0)*8000;

 }

 HAL_I2S_Transmit_DMA(&hi2s3, (uint16_t *)dataI2S, sample_N*2);

 HAL_DAC_Start(&hdac, DAC1_CHANNEL_1);

 HAL_TIM_Base_Start_IT(&htim2);

QUESTION 1: is the function that sends play correct?

QUESTION 2: i have error in the last two lines.

0693W00000UnixtQAB.png 

Dear Sir,

Unfortunately, I am not familiar with STM32 peripherals therefore I cannot help you with that.

We only support Automotive microcontrollers like SPC58.

Thank you in advance for your understanding.

Best Regards,

AutoDevKit Team