Modify i2c timing

This commit is contained in:
Jeremy Soller
2019-11-13 15:50:26 -07:00
parent 77aa419318
commit 7401a540e8
2 changed files with 4 additions and 4 deletions

View File

@ -16,8 +16,8 @@ void smbus_init(void) {
SMB45P3USL = 0xA1;
SMB45P3USH = 0x01;
// Clock set to 50 Hz
SCLKTSA = 1;
// Clock set to 50 KHz
// SCLKTSA = 1;
// Set up for i2c usage
i2c_reset(true);

View File

@ -5,7 +5,7 @@
#include <ec/smbus.h>
//TODO: find best value
#define I2C_TIMEOUT (F_CPU/1000)
#define I2C_TIMEOUT 1000
#define HOSTA_BYTE_DONE (1 << 7)
#define HOSTA_TIMEOUT (1 << 6)
@ -89,7 +89,7 @@ static int i2c_transaction(uint8_t * data, int length, bool read) {
HOSTAA = HOSTAA;
} else {
// Start new transaction
HOCTLA = (1 << 6) | (0b111 << 2) | 1;
HOCTLA = (1 << 6) | (0b111 << 2);
}
// If we are waiting on direction switch