STM32 I2Cv1 driver with interrupts
Posted: Tue Mar 28, 2017 1:41 am
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!
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!