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

i2c module design #22

Open
celery6 opened this issue Oct 18, 2024 · 6 comments · May be fixed by #32
Open

i2c module design #22

celery6 opened this issue Oct 18, 2024 · 6 comments · May be fixed by #32
Assignees
Labels
must do the project will not meet requirements without this

Comments

@celery6
Copy link
Collaborator

celery6 commented Oct 18, 2024

see #5

Provide an interface for reading/writing i2c. Essentially wrap the stm32 HAL calls and configuration, but also consider how to make this rtos-friendly for our purposes. It should be using interrupt-based i2c (not polling). this will be mostly copied over from the "my2c" module from last year, but we want to improve that interface, and tailor it to this project (since my2c is just braindead copypasted from the pic18 projects which are quite different)

Things to figure out:

  • interface
  • stm32 i2c configuration/setup for interrupts, etc
@celery6 celery6 added this to the module design phase milestone Oct 18, 2024
@Joe-Joe-Joe-Joe
Copy link

@Joe-Joe-Joe-Joe
Copy link

I would try to design for the case where you have 2 state estimation threads running in parallel (as seems to be done in some redundant configurations I was looking at), one for each IMU

@Joe-Joe-Joe-Joe
Copy link

Joe-Joe-Joe-Joe commented Oct 18, 2024

They say in that post I linked, give it a pointer to a data buffer (presumably for the read data), but this obviously begs the question of "how does the calling task know that the buffer it passed has been filled". I suppose you could ship a semaphore along with it?
so you would have like

{
uint32_t cmd_len
uint8_t I2C_addr
struct I2Ctransaction *commands
uint32_t data_len
uint8_t *data
SemaphoreHandle_t done
}

@Joe-Joe-Joe-Joe Joe-Joe-Joe-Joe self-assigned this Oct 19, 2024
@Joe-Joe-Joe-Joe
Copy link

image
eh?

@celery6 celery6 added the must do the project will not meet requirements without this label Oct 20, 2024
@celery6
Copy link
Collaborator Author

celery6 commented Nov 9, 2024

update: board respin puts only 1 i2c device on each i2c bus, and each device has its own handler thread so there will be no multithreaded i2c conflicts. task scope decrease!! this module no longer needs to worry about multiple threads accessing the same bus

@taisirhassan taisirhassan self-assigned this Nov 20, 2024
@taisirhassan taisirhassan linked a pull request Nov 20, 2024 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
must do the project will not meet requirements without this
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants