I've recently used TWI driver, driver and I2C works in master mode but I've found some problems:
- void twi_write_byte(Twi *p_twi, uint8_t uc_byte) is not working, using a signal analyzer I see 8 bits of clock, but data is always 0 with a ACK high at the end(ACK it's normal, but data should not be 0).
- In twi_master_write and twi_master_read I provide an 8 bit address that is shifted by one and added a final bit 1 or 0 if it's read or write. Bitshift is working as expected in twi_master_write, but in twi_master_read I've always a 0 at the end of the address like in twi_master_write. Why is not set to 1?
- In struct twi_packet there is an array address and chip, chip is I2C address of the chip, but what is it address? It is a register address of slave device? and, what use have this array when I'm reading a packet from slave?
I've performed a test with twi_packet and twi_master_read, and I've set the first byte of address array and set array size (addr_length) to 1, my reading packet size was 1 byte and I've set packet size (length) to 1. In communication I've read the 1 byte chip address, 1 byte address and 2 byte packet. But I should have 1 byte packet and not 2, and also recived data wasn't written to my variable(was not saved as happen when I set address lenght to 0). Can someone explain becouse adding 1 address I read 2 bytes instead of 1 byte?
Discussion around product based on ARM Cortex M4 core.
2 posts • Page 1 of 1
Who is online
Users browsing this forum: Google [Bot] and 2 guests