Hi, @Giovanni!
I met a problem in my design with STM32F437, I did not looked on DMA streams allocation, so I have now all my alwayw-needed peripherals connected to same DMA channel (UART4, I2S2 and I2C3). I2S2 used to make some type of PWM on external DAC (to increase its accuracy and linearity), so it cannot be changed to any mode except DMA. In UART4 I can use serial driver, so it is not a big problem.
But I2C3 is a problem for me, because I cannot change pcb routing and I cannot stop I2S to periodically use I2C.
I see that I2Cv2 driver can be used without DMA, but I2Cv1 have no such possibility.
I2Cv1 driver was modified such way two years ago by @Thargon (viewtopic.php?t=2604), but it still not included in main repo.
Is there any reasons not to do this?
Sure I can just patch and use it, but may be I have missed some problems that can be seen by professionals only?
And another question. I was met such situations before, I met it now, and this will happen in future. I'm far away of trying to ask to add anything to well-tested main repo (community repo exists for this reason, despite of good quality drivers inside).
Sure I can patch sources in ChibiOS path, but I know that this way is wrong and is a reason for a big pain when updating.
For example, now I can make patched version of I2C2v1 driver (in fact, I will patch it manually to understand how it will work), but will it enough to just place it into different path and correct include paths?
Is there a some type of "best practice" in ChibiOS when I need to 1) add my own driver or 2) replace existing?
Thank you in advance!
STM32 I2Cv1 driver with interrupts
Moderators: RoccoMarco, barthess
- Giovanni
- Site Admin
- Posts: 14455
- Joined: Wed May 27, 2009 8:48 am
- Location: Salerno, Italy
- Has thanked: 1076 times
- Been thanked: 922 times
- Contact:
Re: STM32 I2Cv1 driver with interrupts
Hi,
The I2Cv1 driver has always been problematic because "limitations" of the old STM32 I2C hardware, this is why I prefer to not touch it and this is why that code has not been integrated. If you want to try that code and then test it then it could be added to the community repository (this is the best practice for code I can't include in the mainline for whatever reason).
Note that I added a SW I2C implementation to the trunk repository, it is not yet tested, you could give it a try if you want. This driver should be able to run on any platform.
Giovanni
The I2Cv1 driver has always been problematic because "limitations" of the old STM32 I2C hardware, this is why I prefer to not touch it and this is why that code has not been integrated. If you want to try that code and then test it then it could be added to the community repository (this is the best practice for code I can't include in the mainline for whatever reason).
Note that I added a SW I2C implementation to the trunk repository, it is not yet tested, you could give it a try if you want. This driver should be able to run on any platform.
Giovanni
Re: STM32 I2Cv1 driver with interrupts
I have applied the patch and it works as expected (with little cosmetic modifications due to new version of ChibiOS).
Driver works like I2Cv2 version, with DMA or IRQ depending on same STM32_I2C_USE_DMA define.
I do not know how to add something to community right way, so I will attach patched driver here.
Can you add it by yourlself?
If not, please tell me how to add it, because I think its presence can be helpful to other people.
Thanks!
Driver works like I2Cv2 version, with DMA or IRQ depending on same STM32_I2C_USE_DMA define.
I do not know how to add something to community right way, so I will attach patched driver here.
Can you add it by yourlself?
If not, please tell me how to add it, because I think its presence can be helpful to other people.
Thanks!
- Attachments
-
- i2c_lld_dma_or_irq.zip
- (9.57 KiB) Downloaded 215 times
- Giovanni
- Site Admin
- Posts: 14455
- Joined: Wed May 27, 2009 8:48 am
- Location: Salerno, Italy
- Has thanked: 1076 times
- Been thanked: 922 times
- Contact:
Re: STM32 I2Cv1 driver with interrupts
Hi,
The community repository is handled by barthess, contact him via PM in case he does not see this post.
Giovanni
The community repository is handled by barthess, contact him via PM in case he does not see this post.
Giovanni
Re: STM32 I2Cv1 driver with interrupts
Hello.
Sorry for late response. You can submit your driver using pull request on github. Driver must be added with new name to avoid conflicts with existing ones (something like i2c_irq).
Sorry for late response. You can submit your driver using pull request on github. Driver must be added with new name to avoid conflicts with existing ones (something like i2c_irq).
Who is online
Users browsing this forum: No registered users and 34 guests