2976 views|6 replies

2865

Posts

4

Resources
The OP
 

Pingtouge RVB2601 board-IIC bus test [Copy link]

 

The internal design of CH2601 has an IIC bus. The I2C bus on the board is connected to ES7210. The ES7210 chip is a four-channel ADC acquisition chip. A silicon microphone is connected to the board.

The data of ES7210 is connected to CH2601 through I2S bus. The configuration of chip is connected to CH2601 through IIC. I2S is the transmission channel of audio data. I initially planned to use IIC to read the configuration information of ES7210, but I didn't have the information of ES7210, so I couldn't test it. So the only way was to remove the jumper. That is, the two jumpers [3,4] and [5,6] of J1 would do.

Wiring diagram of the board

The two jumper wires PA8 and PA9 will do. I connected these two wires to the adapter at the same time to observe the waveform.

Program reference files

#include "drv/iic.h"
#include <soc.h>

Procedure steps

1. Turn on the pin function, csi_pin_set_mux(PA8, PA8_IIC0_SCL);

2. Initialize the port, ret = csi_iic_init(&master_iic, IIC_IDX); port 0

3. Configure IIC to master mode, ret = csi_iic_mode(&master_iic, IIC_MODE_MASTER);

4. Configure the device address, ret = csi_iic_addr_mode(&master_iic, IIC_ADDRESS_7BIT);

5. Set the IIC bus speed, ret = csi_iic_speed(&master_iic, IIC_BUS_SPEED_STANDARD);

6. Send data, num = csi_iic_master_send(&master_iic, IIC_SLAVE_ADDR, write_data, sizeof(write_data), 100000);

7. Receive data, num = csi_iic_master_receive(&master_iic, IIC_SLAVE_ADDR, read_data, sizeof(read_data), 100000);

#include "drv/iic.h"
#include <soc.h>

#define IIC_SLAVE_ADDR      0x50
#define IIC_IDX             0
static csi_iic_t master_iic;

int example_iic(void)
{
  uint8_t write_data[10];
  uint8_t read_data[10];
  csi_error_t ret;
  uint32_t i;
  int32_t num;
  
  csi_pin_set_mux(PA8, PA8_IIC0_SCL);
  csi_pin_set_mux(PA9, PA9_IIC0_SDA);
  
  ret = csi_iic_init(&master_iic, IIC_IDX);
  if (ret != CSI_OK) {
    printf("csi_iic_initialize error\n");  
    return -1;
  }
  /* config iic master mode */  
  ret = csi_iic_mode(&master_iic, IIC_MODE_MASTER);
  if (ret != CSI_OK) {
      printf("csi_iic_set_mode error\n");
      return -1;
  }
  /* config iic 7bit address mode */  
  ret = csi_iic_addr_mode(&master_iic, IIC_ADDRESS_7BIT);
  if (ret != CSI_OK) {
      printf("csi_iic_set_addr_mode error\n");
      return -1;
  }
  /* config iic standard speed*/  
  ret = csi_iic_speed(&master_iic, IIC_BUS_SPEED_STANDARD);
  if (ret != CSI_OK) {
      printf("csi_iic_set_speed error\n");
      return -1;
  }

  for (i = 0; i < sizeof(write_data); i++) { 
      write_data = i;           ///< init write_data value
  }

  num = csi_iic_master_send(&master_iic, IIC_SLAVE_ADDR, write_data, sizeof(write_data), 100000);
  if (num != sizeof(write_data)) {
      printf("csi_iic_master_send error\n");
      return -1;
  }

  num = csi_iic_master_receive(&master_iic, IIC_SLAVE_ADDR, read_data, sizeof(read_data), 100000);
  if (num != sizeof(read_data)) {
      printf("csi_iic_master_receive error\n");
      return -1;
    }
  csi_iic_uninit(&master_iic);
  return 0;
}

I called the test function in the main program

int main(void)
{
    board_yoc_init();
	example_iic();
    LOGD(TAG, "%s\n", aos_get_app_version());
    oled_init();
	
    while (1) {
        LOGD(TAG, "Hello world! YoC");
        aos_msleep(1000);
    }

    return 0;
}

I used an oscilloscope and saw pulse output, but I don't know why the program always gets stuck in the function num = csi_iic_master_send(&master_iic, IIC_SLAVE_ADDR, write_data, sizeof(write_data), 100000);

And whether the timeout mechanism works. You can see that there is a while(1) loop in the function. Guess: The possible reason is that there is no device connected and no ACK signal!

This post is from Domestic Chip Exchange

Latest reply

You poll and scan the IIC peripheral devices, try from 0x01 to 0xff and see if there is any response.   Details Published on 2021-9-13 16:17
 
 

9702

Posts

24

Resources
2
 

It should be that I2C must have a slave device with a matching address to respond.

This post is from Domestic Chip Exchange
 
 
 

6555

Posts

0

Resources
3
 

It should be because there is no access device.

This post is from Domestic Chip Exchange
 
 
 

1412

Posts

3

Resources
4
 
Read the ID first and see if you can read it?
This post is from Domestic Chip Exchange

Comments

That's what I thought at first, but there's no information about ES7210.  Details Published on 2021-9-11 10:21
 
 
 

2865

Posts

4

Resources
5
 
annysky2012 posted on 2021-9-11 10:13 Read the ID first and see if you can read it out?

That's what I thought at first, but there's no information about ES7210.

This post is from Domestic Chip Exchange

Comments

Ask the manufacturer  Details Published on 2021-9-13 16:17
Ask the manufacturer  Details Published on 2021-9-11 10:39
 
 
 

1412

Posts

3

Resources
6
 
bigbat posted on 2021-9-11 10:21 That’s what I thought at first, but there is no information about ES7210

Ask the manufacturer

This post is from Domestic Chip Exchange
Personal signature

没有什么不可以,我就是我,不一样的烟火! 

 
 
 

1942

Posts

2

Resources
7
 
bigbat posted on 2021-9-11 10:21 That’s what I thought at first, but there is no information about ES7210

You poll and scan the IIC peripheral devices, try from 0x01 to 0xff and see if there is any response.

This post is from Domestic Chip Exchange
 
 
 

Just looking around
Find a datasheet?

EEWorld Datasheet Technical Support

Featured Posts
Homemade STEVAL-IPM05F 3Sh board: FOC motor control 400V/8A non-sensing/sensing Hall/sensing encoder and other reference programs...

This post was last edited by music_586 on 2019-4-4 19:06 This content was originally created by EEWORLD forum user musi ...

C language uses binary tree to parse polynomials and evaluate

It mainly realizes the analysis of polynomial data calculation. If there is a need to make a simple calculator based on ...

Zhouyi Compass Simulation Experiment 2——Environment and Routine Analysis

Zhouyi Compass Simulation Experiment 2——Environment and Routine Analysis In simulation experiment 1 (https://bbs.eewor ...

【Development and application based on NUCLEO-F746ZG motor】13. Parameter configuration - USART3 configuration

The function of this serial port on the development board is to communicate with ST-LINK, and then connect ST_LINK2 to t ...

[EEWorld invites you to play disassembly] PISEN fast charging power bank 10500mAh 22.5W

Quote: Thank you EEWorld for inviting you to the disassembly (fourth issue): popular power bank disassembly event. As w ...

Please tell me why this machine often burns the starting resistor at the customer's place

Please tell me why the resistor burned out and how to fix it? 627875627874627873

[Flower carving hands-on] Interesting and fun music visualization series of small projects (26) - LED hypercube

This post was last edited by eagler8 on 2022-10-5 08:59 I had the urge to do a series of topics on sound visualization. ...

Is it possible to perform socket communication without IP and port number?

When using socket communication, whether it is internal communication within the local machine or communication betwee ...

Development Background and Advantages of SiC Power Devices

SiC power components have higher withstand voltage, lower on-resistance, can operate at higher speeds, and can operate a ...

【Digi-Key Follow me Issue 2】Task Collection

I got the board quite late, and after completing the task, I got busy with a lot of other things so I didn't have time t ...

EEWorld
subscription
account

EEWorld
service
account

Automotive
development
circle

Copyright © 2005-2024 EEWORLD.com.cn, Inc. All rights reserved 京B2-20211791 京ICP备10001474号-1 电信业务审批[2006]字第258号函 京公网安备 11010802033920号
快速回复 返回顶部 Return list