Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

bank selection doesn't work properly #12

Open
adambujak opened this issue Jul 18, 2021 · 3 comments
Open

bank selection doesn't work properly #12

adambujak opened this issue Jul 18, 2021 · 3 comments
Labels
bug Something isn't working help wanted Extra attention is needed

Comments

@adambujak
Copy link

adambujak commented Jul 18, 2021

I think you need to shift it to the left by 4 because right now you are setting bits 0 and 1 as far as I can tell

@stephendpmurphy
Copy link
Owner

Hmmm, honestly haven't touched or used this since I wrote it. I thought I had tested accessing other banks but maybe not.. If you find this issue is true, please feel free to submit a PR to fix it. Otherwise, I will fix it once I get around to it 👍

@stephendpmurphy stephendpmurphy added bug Something isn't working help wanted Extra attention is needed labels Jul 19, 2021
@zafbangash
Copy link

I used this code recently, and can confirm while being very well structured, the bank selection is incorrect. for example:

dev.usr_bank.reg_bank_sel = ICM20948_USER_BANK_0;  // (whichever user bank it is, 0, 1, 2)  
// Write to the reg bank select to select bank 0
ret = _spi_write(ICM20948_ADDR_REG_BANK_SEL,  (uint8_t *)&dev.usr_bank.reg_bank_sel, 0x01);

can / should be replaced with

dev.usr_bank.bank0.bytes.REG_BANK_SEL.bits.USER_BANK = ICM20948_USER_BANK_0;    //(again, X being the bank) //// Write to the reg bank select to select bank 0
ret = _spi_write(ICM20948_ADDR_REG_BANK_SEL,& dev.usr_bank.bank0.bytes.REG_BANK_SEL.byte, 0x01);

@stephendpmurphy
Copy link
Owner

@zafbangash thanks for confirming this. Happy to review any PR back into the repo to get this fixed!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

3 participants