Hi, I'm working on getting fixing/finalizing/testing the ADCv4 peripheral on STM32H7.
The progress is on https://github.com/pierstitus/ChibiOS/commits/adcv4
Things that have been fixed already:
- finishing ADC3 implementation
- making ADC12 dual mode work
- single conversions (with circular=false)
- clock calculation and BOOST register
Things to consider:
- Clock prescaler (PRESC register) is not taken into account for clock calculation and BOOST register. Doesn't seem to give problems, but good to know.
- ADC3 uses BDMA, hence the samples buffer must be in sram4.
There's still an issue with double buffering/half transfer interrupt, but that is something bigger, as it is also in ADCv2/STM32F4. I can post a separate bug report for that, though I just set the buffer depth to 1 to circumvent this issue.
I still want to do some more testing, and I think it would be nice to have these tests available in a structured way.
I often use the testhal projects as a start to try new peripherals, and think it would be useful to have a bit more extensive tests of the different possibilities.
I have tried to improve the multi ADC example (see viewtopic.php?p=38248), but think the ADCv4 deserves its own bit more extensive example, so I'd like to clean up the tests I did already and add them separately in testhal, how do you think about that?
STM32H7 ADCv4 patches Topic is solved
- Giovanni
- Site Admin
- Posts: 14457
- Joined: Wed May 27, 2009 8:48 am
- Location: Salerno, Italy
- Has thanked: 1076 times
- Been thanked: 922 times
- Contact:
Re: STM32H7 ADCv4 patches
Please submit separate patches for each issue, not megapatches, all bugs are traced separately.
Giovanni
Giovanni
- piers
- Posts: 42
- Joined: Fri Apr 06, 2012 1:02 am
- Location: Netherlands
- Been thanked: 15 times
- Contact:
Re: STM32H7 ADCv4 patches
Hi Giovanni,
It is separated as different commits, I tried to keep the different things separated that way. Since a lot of them patch the same file and are very connected it was much easier to make them build on top of each other.
Also I've used STM32_ENFORCE_H7_REV_Y instead of STM32_ENFORCE_H7_REV_V.
Can you get the patches from github or do you want to have them attached to the forum?
It is separated as different commits, I tried to keep the different things separated that way. Since a lot of them patch the same file and are very connected it was much easier to make them build on top of each other.
Also I've used STM32_ENFORCE_H7_REV_Y instead of STM32_ENFORCE_H7_REV_V.
Can you get the patches from github or do you want to have them attached to the forum?
- Giovanni
- Site Admin
- Posts: 14457
- Joined: Wed May 27, 2009 8:48 am
- Location: Salerno, Italy
- Has thanked: 1076 times
- Been thanked: 922 times
- Contact:
- Giovanni
- Site Admin
- Posts: 14457
- Joined: Wed May 27, 2009 8:48 am
- Location: Salerno, Italy
- Has thanked: 1076 times
- Been thanked: 922 times
- Contact:
Re: STM32H7 ADCv4 patches
Hi,
Note that now it is called STM32_ENFORCE_H7_REV_XY because it is required for both RevX and RevY.
Giovanni
Note that now it is called STM32_ENFORCE_H7_REV_XY because it is required for both RevX and RevY.
Giovanni
- piers
- Posts: 42
- Joined: Fri Apr 06, 2012 1:02 am
- Location: Netherlands
- Been thanked: 15 times
- Contact:
Re: STM32H7 ADCv4 patches
Hi Giovanni,
Finally got around to separate the patches even more cleanly and use STM32_ENFORCE_H7_REV_XY.
There's 10 patches now in the attached zip file:
- ADCv4 dual mode DMA transfer size fix
- ADCv4 add dual mode ADC_CCR_DUAL_ defines
- ADCv4 REV-V ADC_CFGR_RES fixes
- ADCv4 fix ADC clock calculation for STM32H7 REV-V
- ADCv4 configure ADC boost
- ADCv4 fix dual adc mode
- ADCv4 implement ADC3 BDMA setup
- ADCv4 fix DMNGT register typo - Caused problems with single conversions (with circular=false)
- BDMAv1 fix interrupt flags
- ADCv4 add missing channel 19
I tested most combinations of usage, if you want to have a more extensive ADCv4 test/example for in testhal I can clean up what I've got here as a separate test project.
Finally got around to separate the patches even more cleanly and use STM32_ENFORCE_H7_REV_XY.
There's 10 patches now in the attached zip file:
- ADCv4 dual mode DMA transfer size fix
- ADCv4 add dual mode ADC_CCR_DUAL_ defines
- ADCv4 REV-V ADC_CFGR_RES fixes
- ADCv4 fix ADC clock calculation for STM32H7 REV-V
- ADCv4 configure ADC boost
- ADCv4 fix dual adc mode
- ADCv4 implement ADC3 BDMA setup
- ADCv4 fix DMNGT register typo - Caused problems with single conversions (with circular=false)
- BDMAv1 fix interrupt flags
- ADCv4 add missing channel 19
I tested most combinations of usage, if you want to have a more extensive ADCv4 test/example for in testhal I can clean up what I've got here as a separate test project.
- Attachments
-
- ADCv4-patches.zip
- (11.44 KiB) Downloaded 260 times
- Giovanni
- Site Admin
- Posts: 14457
- Joined: Wed May 27, 2009 8:48 am
- Location: Salerno, Italy
- Has thanked: 1076 times
- Been thanked: 922 times
- Contact:
Re: STM32H7 ADCv4 patches
Hi,
Good work with all the patches (almost flawless). I had to change a reference to STM32_SYSCLK (undefined) to STM32_HCLK. I hope everything is OK now.
Fixed bug as #1117.
Giovanni
Good work with all the patches (almost flawless). I had to change a reference to STM32_SYSCLK (undefined) to STM32_HCLK. I hope everything is OK now.
Fixed bug as #1117.
Giovanni
- piers
- Posts: 42
- Joined: Fri Apr 06, 2012 1:02 am
- Location: Netherlands
- Been thanked: 15 times
- Contact:
Re: STM32H7 ADCv4 patches
Great.
Note that for the BDMA of ADC3 the samples buffer needs to be in ram4. Probably that's not immediately clear for everybody.
Note that for the BDMA of ADC3 the samples buffer needs to be in ram4. Probably that's not immediately clear for everybody.
- alex31
- Posts: 379
- Joined: Fri May 25, 2012 10:23 am
- Location: toulouse, france
- Has thanked: 38 times
- Been thanked: 62 times
- Contact:
Re: STM32H7 ADCv4 patches
Hello,
I am trying to use ADC3 working on an H743ZI rev 'V' (newer nucleo board)
for now I am stuck, the dma never fire interrupt for end of transfert so ADCConvert block forever, but the other threads are working fine, no hardfault.
I use sram4 for the samples, have set all the DBG flags in ch.conf and enabled errorcallback (which was useful to show me that I was not using sram4 at first).
Since there is no ADC3 example, i have used ADC1 example and just made the changes to use ADC3 instead ADC1.
any idea, if someone has a minimal ADC3 working example, i am interested
A.
I am trying to use ADC3 working on an H743ZI rev 'V' (newer nucleo board)
for now I am stuck, the dma never fire interrupt for end of transfert so ADCConvert block forever, but the other threads are working fine, no hardfault.
I use sram4 for the samples, have set all the DBG flags in ch.conf and enabled errorcallback (which was useful to show me that I was not using sram4 at first).
Since there is no ADC3 example, i have used ADC1 example and just made the changes to use ADC3 instead ADC1.
any idea, if someone has a minimal ADC3 working example, i am interested
A.
- Giovanni
- Site Admin
- Posts: 14457
- Joined: Wed May 27, 2009 8:48 am
- Location: Salerno, Italy
- Has thanked: 1076 times
- Been thanked: 922 times
- Contact:
Re: STM32H7 ADCv4 patches
The interrupt should come from DMA, is the ADC actually reading samples in memory?
Anyway, please use the support forum for this kind of things, it is not yet a bug report.
Giovanni
Anyway, please use the support forum for this kind of things, it is not yet a bug report.
Giovanni
Who is online
Users browsing this forum: No registered users and 53 guests