GithubHelp home page GithubHelp logo

linuxdronelab / pru-i2c-lib Goto Github PK

View Code? Open in Web Editor NEW
4.0 2.0 3.0 17 KB

BeagleBone Black AM335x PRU firmware library for i2c implementation

License: Apache License 2.0

C 100.00%
beaglebone-black pru i2c pru-i2c am335x linuxdrone driver

pru-i2c-lib's People

Contributors

o8o avatar

Stargazers

 avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

Forkers

fpf3 frank2597 jjd35

pru-i2c-lib's Issues

Only the first transaction works

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).

image

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.

image

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;
}

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.