Modifying GADC example board file.

daviddawe1982
Posts: 94
Joined: Thu Apr 11, 2013 10:35 am

Modifying GADC example board file.

Postby daviddawe1982 » Sun May 05, 2013 11:09 am

Hello,
I have been trying to build the gadc example but i have one weird problem when i modify the gadc config file it causes the code to crash..what i mean is with out modifying i get a AT91_ADC1_RESOLUTION undeclared error witch is to be expected as i am using a stm32f4 discovery but when i edit the config file to stm32f4 specs i get a ton of errors including but not limited to
undefined reference to `halInit' main.c /gadc
undefined reference to `gdispInit' main.c /gadc
undefined reference to `GDISP' main.c /gadc
etc etc.
i have included all paths and it works when i test it with the gdisp benchmark demo.
the errors only come up after gadc driver config editing.
i even tried to declare the at91 adc resolution in the stm32f4 adc_llc with a unedited gadc config file and it also causes the errors.
what would cause this and is there a way around it.

User avatar
Tectu
Posts: 1226
Joined: Thu May 10, 2012 9:50 am
Location: Switzerland
Contact:

Re: Modifying GADC example board file.

Postby Tectu » Sun May 05, 2013 11:14 am

You cannot just change the config file in order to make it work on an STM32F4. You have to write the entire driver.


~ Tectu

inmarket
Posts: 89
Joined: Fri Jul 27, 2012 1:37 pm
Location: Brisbane, Australia

Re: Modifying GADC example board file.

Postby inmarket » Sun May 05, 2013 11:28 am

You will notice that there is a GADC driver for the AT91SAM7.

This driver connects the GADC layer to the AT91SAM7 ChibiOS ADC driver.
A similar driver needs to be written for the STM32. Just changing the config file in the AT91SAM7 driver is unfortunately not enough.
The driver for the STM32 would be very similar to the AT91SAM7 but there would be differences. For example, the ChibiOS ADC driver for the AT91 supports doing the ADC conversions directly from one of the cpu timers without the use of a special timer ISR. I suspect that the STM32 ADC driver doesn't do the same so a timer would need to be set up and an ISR written to schedule the ADC conversions. It sounds more complex than it would actually be.
All of this is necessary because ChibiOS does not have a fully hardware independent interface for the ADC driver. Each cpu's ADC driver in ChibiOS is slightly different hence the need for a special GADC driver for each cpu type.


As I do not have a STM32 board I cannot easily write the driver for that cpu.
We would love it if you wrote a GADC driver for the ATM32 cpu.

daviddawe1982
Posts: 94
Joined: Thu Apr 11, 2013 10:35 am

Re: Modifying GADC example board file.

Postby daviddawe1982 » Sun May 05, 2013 11:34 am

well i am a complete novice i am almost tempted to send you the spare stm32f4 discovery i have lol

daviddawe1982
Posts: 94
Joined: Thu Apr 11, 2013 10:35 am

Re: Modifying GADC example board file.

Postby daviddawe1982 » Sun May 05, 2013 11:37 am

tectu is there a was to make the standard chibios adc conversion result a string so that i could then use it to make a graph eg. conversion result is hight of rectangle

User avatar
Tectu
Posts: 1226
Joined: Thu May 10, 2012 9:50 am
Location: Switzerland
Contact:

Re: Modifying GADC example board file.

Postby Tectu » Sun May 05, 2013 11:39 am

I have five STM32F4 discovery board and an like a dozen other STM32 dev board here. Sending over a board would not be necessary ;-)
Writing a GADC driver for the STM32 MCUs is on my ToDo list, but not very nearly on the top...


~ Tectu

daviddawe1982
Posts: 94
Joined: Thu Apr 11, 2013 10:35 am

Re: Modifying GADC example board file.

Postby daviddawe1982 » Sun May 05, 2013 11:43 am

ok i will wait ;) . i really like the idea of your gadc example and would work well on my project . would my above idea work in the meanwhile to get some thing basic working
??

User avatar
Tectu
Posts: 1226
Joined: Thu May 10, 2012 9:50 am
Location: Switzerland
Contact:

Re: Modifying GADC example board file.

Postby Tectu » Sun May 05, 2013 11:53 am

Why don't you try to write it yourself? It's supposed to be very easy. Everything you have to do is using the high level HAL provided by ChibiOS/RT. You can use the existing driver for the AT91SAM7 as a template.


~ Tectu

daviddawe1982
Posts: 94
Joined: Thu Apr 11, 2013 10:35 am

Re: Modifying GADC example board file.

Postby daviddawe1982 » Sun May 05, 2013 12:01 pm

i will have a play but i think it may be beyond me at the moment as i cant even get the chibios/rt adc to display a result :(
i was hoping it used something like return ADC_GetConversionValue(ADC1).

User avatar
Tectu
Posts: 1226
Joined: Thu May 10, 2012 9:50 am
Location: Switzerland
Contact:

Re: Modifying GADC example board file.

Postby Tectu » Sun May 05, 2013 12:06 pm

What exactly do you want to do?


~ Tectu


Return to “LCD Driver and Graphic Framework”

Who is online

Users browsing this forum: No registered users and 0 guests