linuxdronelab / pru-i2c-lib Goto Github PK
View Code? Open in Web Editor NEWBeagleBone Black AM335x PRU firmware library for i2c implementation
License: Apache License 2.0
BeagleBone Black AM335x PRU firmware library for i2c implementation
License: Apache License 2.0
I am using this library to sample some sensors over the I2C bus using the PRUs on the Beaglebone Black. It seems as if only the first transaction works correctly, after which the library seems to only attempt to read from register address 0xFF, followed by the SCL line being pulled low (see attached image captures by logic analyzer).
While trying to find the problem myself, I decided to write the register address and received data in the shared memory to inspect using prudebug. For this test, I am attempting to read registers 0x00 and 0x03. Interestingly, it writes the correct register addresses into memory (see image), but only the first returned value is correct (0xEA). The value written into the received data buffer in shared memory is 0xFF, which does not make sense. As can be seen from the logic analyzer, 0xFF is the address it attempts to read from.
I don't know what I am doing wrong here, but any help would be appreciated!
uint8_t curr_data_idx = 0;
uint8_t tmp = 0;
uint8_t i = 0;
volatile uint8_t * buf = ((volatile uint8_t*)(RESERVED_SMEM_ADDR + 32));
int main(void)
{
// enable OCP
CT_CFG.SYSCFG_bit.STANDBY_INIT = 0;
pru_i2c_driver_DelayMicros(500000);
uint8_t res = 0;
res = pru_i2c_driver_Init(1);
uint8_t saddr = 0x68;
pru_i2c_driver_ReadReg(1, saddr, i, &tmp);
buf[curr_data_idx] = tmp;
pru_i2c_driver_DelayMicros(100);
curr_data_idx++;
i = 0x03;
pru_i2c_driver_ReadReg(1, saddr, i, &tmp);
buf[curr_data_idx] = tmp;
pru_i2c_driver_DelayMicros(100);
curr_data_idx++;
__halt();
return 0;
}
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.