Hi dialog team
我有一个疑问对于接口RTC通过我2c i need to use GPIO port 2 pins 4,5 . So the question is where should i configure the GPIO pins ? as of now am using proximity reporter_fh program for adding my interfacing and check its working or not ! so in pheriph_setup.c am reserving and configuring my GPIO pins . is this way correct ? or is there any other standard way to define those GPIO pins ??
2) also how to configure these pins as input_output pins as during i2c communication the pin should be working as both input &output .
am using the eeprom interfacing example in order to port to my RTC .so am in need of your support in these and awaiting for your response .
Thankyou
Hi,
You can check the peripheral_examples from the path:DA1458x_SDK_3.0.6\peripheral_examples.
It shows how to handle I2C communication.
1) Indeed, you have to declare the GPIOs pin in:
set_pad_functions(void)
2) For I2C, it should be:
GPIO_ConfigurePin(I2C_GPIO_PORT, I2C_SCL_PIN, INPUT, PID_I2C_SCL, false);
GPIO_ConfigurePin(I2C_GPIO_PORT, I2C_SDA_PIN, INPUT, PID_I2C_SDA,false);
regards,
DIALOG_TEAM.
Hi i tried with pheriperal example to interface I2C with my RTC . As of now am using Abracon RTC 1804 ,It is 7-bit addressing mode . but when i call read or write ,the inbuilt function i2c_wait_until_eeprom_ready() is called and this function gets hangup !! i tried disabling this function but still no response from my RTC. ( testing the RTC with i2c debugger concludes RTC workin properly)
as in the example now i have connected the rtc on Port 0 2 & 3 pins ! i can see the data signal & clock signals using scope , tryin to write to my RTC and it just gets hanged up like this !
the DA daughter board is in Boost mode .
am awaiting for your response !!
Am totally stuck in this interfacing part .The hardware connections seems to be fine ! It would be helpful if you reply asap! because am running out of time.. !
Hi,
At the moment, we have created specific I2C APIs for EEPROM memories.
All the APIs function can be found in: i2c_eeprom.c file and you need to change some of the APIs, for instance:
uint8_t i2c_eeprom_read_byte(uint32_t address)
{
i2c_wait_until_eeprom_ready();
i2c_send_address(address);
// WAIT_WHILE_I2C_FIFO_IS_FULL(); // MUST BE REMOVED
SEND_I2C_COMMAND(0x0100); // Set R/W bit to 1 (read access)
//WAIT_UNTIL_I2C_FIFO_IS_EMPTY(); // MUST BE REMOVED
WAIT_FOR_RECEIVED_BYTE(); // Wait for received data
return (0xFF & GetWord16(I2C_DATA_CMD_REG)); // Get received byte
}
Our plan is to create generic I2C APIs for every sensors, but this is not available yet I am afraid.
Sorry for this convenience.
regards,
DIALOG_TEAM.
Hi Dialog_Team,
I can't find the i2c_eeprom.c file. Is it in the SDK? Please let me know how can i find it and which SDK.
Thanks,
Alex
Its is better to create a generic API for I2C communication !
but as of now while porting to custom I2C file , am not getting acknowledgement from RTC (abracon 1804) .i checked by reading the I2C_TX_ABRT_SOURCE_REG register !
could you explain in detail which registers to be used in order to acess the RTC via I2C in detail !!
Thankyou
Its is better to create a generic API for I2C communication !
but as of now while porting to custom I2C file , am not getting acknowledgement from RTC (abracon 1804) .i checked by reading the I2C_TX_ABRT_SOURCE_REG register !
could you explain in detail which registers to be used in order to acess the RTC via I2C in detail !!
Thankyou
Its is better to create a generic API for I2C communication !
but as of now while porting to custom I2C file , am not getting acknowledgement from RTC (abracon 1804) .i checked by reading the I2C_TX_ABRT_SOURCE_REG register !
could you explain in detail which registers to be used in order to acess the RTC via I2C in detail !!
Thankyou
Hi,
Please see from page 112 of thehttp://support.dialog-semiconductor.com/system/files/resources/DA14580_D...to have all the details.
regards,
DIALOG TEAM.
Hello,
The i2c_eeprom.c can be found from the peripheral template.
regards,
DIALOG TEAM.
Hi GL,
I found it, but some parameters is unclear due to no doc. Please give advise some in i2c_eeprom_init():
device address, uint16_t dev_address, but the device address is 7 bit. I just put this number into dev_address such as 0x00A0, and R/W bit set 0? Is it correc
Thanks,
Alex
Hi,
It is possible to use the I2C EEPROM drivers for controlling other I2C-applications-chips, non EEPROM. A temperature sensor (SE95) example is shown below.
step 1. open the SDK-software:
SDK … \peripheral_examples … DA14580_peripheral_setup.uvproj
step 2. see: periph_setup.h:
change the HARDWARE_CONFIGURATION_INDEX (.) to ‘1’.
/* Test Definition - Select the Configuration that matches your H/W setup
*---------------------------------------------------------
* (0) SPI FLASH MEMORY WITH UART
* (1) I2C EEPROM WITH UART
* (2) QUADRATURE ENCODER WITH BUZZER AND UART
*---------------------------------------------------------
*/
// Hardware Configuration <0=> SPI Flash with UART <1=> I2C EEPROM with UART <2=> Quadrature Encoder, Timers & Buzzer with UART
#define HARDWARE_CONFIGURATION_INDEX (1) // 1 => I2C
step 3.
add new software in: eeprom_test.c (at the beginning of the file)
volatile int16_t temperature;
volatile int ii;
// testing peripheral SE95 temperature sensor
// address = 1001 A2 A1 A0 R/W => 7bitaddress = 0x48 ... 0x48 + 7 = 0x4F
i2c_eeprom_init(0x48, I2C_STANDARD, I2C_7BIT_ADDR, I2C_1BYTE_ADDR);
// reading internal ID-number:
ii = i2c_eeprom_read_byte(0x05); // test reading ID-value = 0xA1
// reading temperature
btrd = i2c_eeprom_read_data(rd_data, 0, 2);
temperature = 256 * rd_data[0] + rd_data[1];
temperature = temperature / 8; // shift 3 bits to right
I hope this example make it easier to understand.
虽然i2c-dri给出建议vers work only for EEPROM, but that is not true.
{hm}