/var/www/restricted/ssh/stm32/www/stm32circle/ STM CircleOS forum / ADC and CircleOS

Username:     
Password:     
             

Forum

# 1   2010-08-03 20:56:08 ADC and CircleOS

alberto
Member
Registered: 2010-06-25
Posts: 11

ADC and CircleOS

I´m trying to read an external signal with ADC form a CircleOS application but I can't.
Then I must use  these signals for some kind of procees. How can I do this?
There any kind of special sintaxis to do this?

Offline

 

# 2   2010-08-11 14:48:33 ADC and CircleOS

yrt
Administrator
From: Grenoble-France
Registered: 2008-06-11
Posts: 520
Website

Re: ADC and CircleOS

Hi,

Take a look to this topic http://www.stm32circle.com/forum/viewtopic.php?id=918
As said in the topic, the CircleOS already uses the ADC 1. So it should be adapted in order to read other channels in a CircleOS application (to add channels into DMA acquisition), or you have to use the ADC2.

Yves

Offline

 

# 3   2010-08-13 00:42:54 ADC and CircleOS

alberto
Member
Registered: 2010-06-25
Posts: 11

Re: ADC and CircleOS

Ok...but i'm trying to read two external signals from expansion ports then convert each signal to digital so i can add these signals and make a process with them, how can i configure each ADC to take samples with the same sample time? and is the DAC enable to use so i can convert digital data to continious and which port is and how can configure it?

Thank you

Offline

 

# 4   2010-08-13 09:21:22 ADC and CircleOS

yrt
Administrator
From: Grenoble-France
Registered: 2008-06-11
Posts: 520
Website

Re: ADC and CircleOS

Take a look at the Primer User Manual at his page http://www.stm32circle.com/resources/stm32primer2.php in order to find the available ports for DAC. It seems that PA4 (DAC_OUT1) can be use in Pin 17 of the extension connector.
Look at the examples of the ST libraries fo ADC management, "3ADCs_DMA" for example.

Offline

 

# 5   2010-08-21 17:30:13 ADC and CircleOS

alberto
Member
Registered: 2010-06-25
Posts: 11

Re: ADC and CircleOS

Ok..I been looking that but I can't configure ADC and DAC, the sintax i use is not recognize by the program, i been adding libraries but these generate errors so i dont know what can i do..my current circle os version is 3.80, i think that this is not a problem for that, well, making a review, what libraries must be added to the project in circle os so the sintax exposed in STM32_Firmware_Library.pdf can be used, and what specific file, i meant .h or .c, must be used for that?, it must be a newer version?.

I been seeing projects like Fast Chart or ECG, but i can't replicate its sintax.

Please, i need this information

Thank you

Offline

 

# 6   2010-08-22 03:02:49 ADC and CircleOS

alberto
Member
Registered: 2010-06-25
Posts: 11

Re: ADC and CircleOS

Well, now i read this from a file when i compile my project..

================================================================================
|                Solving STM32 Precompiled Library conflicts                   |
================================================================================
|  Starting with version 1.24 (September 2009), RKit-ARM for Ride7 does        |
|  not support the precompiled ST library anymore for STM32 devices.           |
|                                                                              |
|  Older STM32 projects that were designed with ST Firmware Library V2.3.0     |
|  can still use the precompiled version, along with the stm32f10x_xxx.h files.|
|  However, new projects should use the ST Firmware Library version 3.1.0 or   |
|  later.                                                                      |
|                                                                              |
|  if you receive a compiler error, you are probably developing a project      |
|  with the ST Firmware Library v3.1.0 or later, but the corresponding .h      |
|  file could not be found in your local project folders, so the current       |
|  file has been _mistakenly_ included.                                        |
|----------------------------------------------------------------------------- |
|  To solve this problem, take the header files from the ST Firmare Library    |
|  v3.1.0 and copy them to your project source folder.                         |
================================================================================

I did that, I added the file <stm32f10x_adc.h> from STM32F10x_LIB_V3.0.1 directory but the build failed, i got these errors:

In file included from C:\Users\USUARIO\Desktop\Prueba\Application.c:12: 
./stm32f10x_adc.h: At top level: 
./stm32f10x_adc.h:55: error: expected specifier-qualifier-list before 'FunctionalState' 
./stm32f10x_adc.h:427: error: expected declaration specifiers or '...' before 'FunctionalState' 
./stm32f10x_adc.h:428: error: expected declaration specifiers or '...' before 'FunctionalState' 
./stm32f10x_adc.h:429: error: expected declaration specifiers or '...' before 'FunctionalState' 
./stm32f10x_adc.h:431: error: expected '=', ',', ';', 'asm' or '__attribute__' before 'ADC_GetResetCalibrationStatus' 
./stm32f10x_adc.h:433: error: expected '=', ',', ';', 'asm' or '__attribute__' before 'ADC_GetCalibrationStatus' 
./stm32f10x_adc.h:434: error: expected declaration specifiers or '...' before 'FunctionalState' 
./stm32f10x_adc.h:435: error: expected '=', ',', ';', 'asm' or '__attribute__' before 'ADC_GetSoftwareStartConvStatus' 
./stm32f10x_adc.h:437: error: expected declaration specifiers or '...' before 'FunctionalState' 
./stm32f10x_adc.h:439: error: expected declaration specifiers or '...' before 'FunctionalState' 
./stm32f10x_adc.h:442: error: expected declaration specifiers or '...' before 'FunctionalState' 
./stm32f10x_adc.h:443: error: expected declaration specifiers or '...' before 'FunctionalState' 
./stm32f10x_adc.h:445: error: expected declaration specifiers or '...' before 'FunctionalState' 
./stm32f10x_adc.h:446: error: expected declaration specifiers or '...' before 'FunctionalState' 
./stm32f10x_adc.h:447: error: expected '=', ',', ';', 'asm' or '__attribute__' before 'ADC_GetSoftwareStartInjectedConvCmdStatus' 
./stm32f10x_adc.h:455: error: expected ')' before 'NewState' 
./stm32f10x_adc.h:456: error: expected '=', ',', ';', 'asm' or '__attribute__' before 'ADC_GetFlagStatus' 
./stm32f10x_adc.h:458: error: expected '=', ',', ';', 'asm' or '__attribute__' before 'ADC_GetITStatus' 


what means those? what can i do?

please

Offline

 

# 7   2010-08-22 09:33:34 ADC and CircleOS

alberto
Member
Registered: 2010-06-25
Posts: 11

Re: ADC and CircleOS

I just get the last firmware (Version 3.30) but i still get the same compile errors...

Please...help..

Offline

 

# 8   2010-08-23 07:06:09 ADC and CircleOS

yrt
Administrator
From: Grenoble-France
Registered: 2008-06-11
Posts: 520
Website

Re: ADC and CircleOS

Hi Alberto,

I didn't understand where was located your problems. It seems that is about the ST library using.
Effectively, when you are using last ST libraries (>3.0), you have to add ST files (.c and .h) into your project, but you also have to configure some files :
- add #include "stm32f10x.h" in "application.c",
- uncomment #define STM32F10X_HD in "stm32f10x.h" to specify the type of µC used by the Primer,
- uncomment #define USE_STDPERIPH_DRIVER in "stm32f10x.h" to specify that you will use the ST library,
- add and modify "stm32f10x_conf.h" in your folder, in order to set which peripheral you will use.

Then it should be compile !

Yves

Offline

 

# 9   2010-08-23 15:25:11 ADC and CircleOS

alberto
Member
Registered: 2010-06-25
Posts: 11

Re: ADC and CircleOS

Ok...Sorry for the missunderstood...my problem is with "stm32f10x_type.h" there are some redefinition like:

C:\Program Files\Raisonance\Ride\Lib\ARM\include/stm32f10x_type.h: At top level: 
C:\Program Files\Raisonance\Ride\Lib\ARM\include/stm32f10x_type.h:48: error: redefinition of typedef 's32' 
C:\Users\USUARIO\Desktop\Prueba\/circle_api.h:42: error: previous declaration of 's32' was here 
 
Build failed

so I have to comment the line in the file to compile..I'll think this can work...

Thank you

Offline

 

# 10   2010-08-24 06:40:15 ADC and CircleOS

yrt
Administrator
From: Grenoble-France
Registered: 2008-06-11
Posts: 520
Website

Re: ADC and CircleOS

It's a problem of library version.
Did you include "stm32f10x.h" in your application and not "stm32f10x_lib.h", and did you change the Ride project parameter "LD linker\Libraries\Use OLD precopiled library" to "No" ?

Offline

 

# 11   2010-08-24 17:00:12 ADC and CircleOS

alberto
Member
Registered: 2010-06-25
Posts: 11

Re: ADC and CircleOS

Ok..I tried that and work  just fine...now I have another problem...when I compile my project I get:

Building C:\Users\USUARIO\Desktop\Prueba\Prueba.rapp
Running: LD
\"C:\Program Files\Raisonance\Ride\arm-gcc\bin\arm-none-eabi-gcc.exe" -mcpu=cortex-m3 -mthumb -Wl,-T -Xlinker "C:\Users\USUARIO\Desktop\Prueba\objdebug\Prueba.elf.ld" -u _start  -nostartfiles -Wl,-Map -Xlinker "C:\Users\USUARIO\Desktop\Prueba\objdebug\Prueba.map"   
c:/program files/raisonance/ride/arm-gcc/bin/../lib/gcc/arm-none-eabi/4.3.2/../../../../arm-none-eabi/bin/ld.exe: C:\Users\USUARIO\Desktop\Prueba\objdebug\Prueba.elf section .text will not fit in region FLASH 
c:/program files/raisonance/ride/arm-gcc/bin/../lib/gcc/arm-none-eabi/4.3.2/../../../../arm-none-eabi/bin/ld.exe: region FLASH overflowed by 1944 bytes 
collect2: ld returned 1 exit status 

do you know what could be the problem now? How can i get more memory?

Thank you..

Offline

 

# 12   2010-08-25 06:26:33 ADC and CircleOS

yrt
Administrator
From: Grenoble-France
Registered: 2008-06-11
Posts: 520
Website

Re: ADC and CircleOS

Hi alberto,

By default, 8 KB of FLASH (and 16KB of RAM) are available for applications, that match with the 32 KB debug limitation (24 KB for CircleOS + 8 KB fo application).
If you need more, you just have to change the linker script "Circle_App.ld" : in the Memory Spaces Definitions. Increase the length parameter in the line : "FLASH (rx) : ORIGIN = 0x8006000, LENGTH = 8K" with the value you want.

Yves

Offline

 

# 13   2010-08-25 20:32:40 ADC and CircleOS

alberto
Member
Registered: 2010-06-25
Posts: 11

Re: ADC and CircleOS

Ok Yves...Thanks a lot...it was very helpfull all that you are been saying...Now I have another cuestion (sorry by that)...I'm using ADC to convert some data, make a process and then set an analog output in a pin using DAC, well, how should I set the output pin?

From Stm32f103xx reference manual, said that I have to put the pin in Analog, but I just find Analog Input.

Thanks again.

Offline

 

# 14   2010-08-26 01:26:35 ADC and CircleOS

alberto
Member
Registered: 2010-06-25
Posts: 11

Re: ADC and CircleOS

Sorry Yves..another problem..When I leave My_App_Handler from my program..I reset some periph like ADC, DAC with:

ADC_DeInit(ADC1);
GPIO_DeInit(GPIOA);
DAC_DeInit();

Then the touchscreen is disable, before I enter to the program, work just fine, I have then to reset the primer to enable again and I don't know why...What could it be?

I try discard reset periph, but didn't work.

Thanks

Offline

 

# 15   2010-08-26 06:46:39 ADC and CircleOS

yrt
Administrator
From: Grenoble-France
Registered: 2008-06-11
Posts: 520
Website

Re: ADC and CircleOS

Hi,

For analog ouput, the reference manual also says :
$1

For ADC, if your application uses the ADC1, of course the VBat measurement and touchscreen management will be broken (see my previous posts in this topic).
I suggest you to use the ADC2 for your application.

Offline

 

# 16   2010-08-26 12:30:14 ADC and CircleOS

alberto
Member
Registered: 2010-06-25
Posts: 11

Re: ADC and CircleOS

Hi Yves,

Thanks for answer so quickly and for the great advice that you have been giving.

I decide to work with ADC2 and it did just fine.

Now I am trying to put a value on DAC Channel 1, I already configure the pin like this:

GPIO_InitTypeDef GPIO_InitStructure;

   GPIO_InitStructure.GPIO_Pin = GPIO_Pin_4;
  GPIO_InitStructure.GPIO_Mode = GPIO_Mode_AIN;
  GPIO_InitStructure.GPIO_Speed = GPIO_Speed_50MHz;
  GPIO_Init(GPIOA, &GPIO_InitStructure);

Then de DAC like:

DAC_InitTypeDef DAC_InitStructure;

  DAC_InitStructure.DAC_Trigger = DAC_Trigger_None;
 
  DAC_InitStructure.DAC_OutputBuffer = DAC_OutputBuffer_Enable;
 
  DAC_Init(DAC_Channel_1, &DAC_InitStructure);
 
  DAC_Cmd(DAC_Channel_1, ENABLE);

After that, I try to put some value:

DAC_SetChannel1Data(DAC_Align_12b_R, 0x0500);

And just exactly that, I try to get the value with:

Sal = DAC_GetDataOutputValue(DAC_Channel_1);

But I get nothing...

I am watching constantly the value of "Sal" and it never change, what could it be?

Thank a lot

Alberto

Offline

 

# 17   2010-08-27 03:47:48 ADC and CircleOS

alberto
Member
Registered: 2010-06-25
Posts: 11

Re: ADC and CircleOS

Hi Yves,

I found the mistake, I did not configure the APB clock, so I did that and now is working great...thanks a lot...

Alberto

Offline

 

# 18   2010-10-10 19:40:12 ADC and CircleOS

jreveane
New member
Registered: 2010-06-25
Posts: 7

Re: ADC and CircleOS

Hi,

Trying  to access to the ADC2 while still using CircleOS, I currently face an  issue with  missing
symbols from the STM32 periph library (ADC, GPIO, DMA).
Browsing this forum for any tips regarding theADC feature I've found this post from
Yves which I have some difficulties to understand:


>Effectively, when you are using last ST libraries (>3.0), you have to add ST files (.c and .h) into your >project, but you also have to configure some files :
>- add #include "stm32f10x.h" in "application.c",
>- uncomment #define STM32F10X_HD in "stm32f10x.h" to specify the type of µC used by the Primer,>
>- uncomment #define USE_STDPERIPH_DRIVER in "stm32f10x.h" to specify that you will use the ST library,
>- add and modify "stm32f10x_conf.h" in your folder, in order to set which peripheral you will use.

So, I've added the missing (adc,dma,gpio) library files into my project and this cleared the linker issue.
However, I was expecting that the Primer2_Circle.elf already included theses objects/symbols (ADC1
is already in used at least) and I don't really understand why I should add these files again ?
Isn't it a duplicate and a waste of Flash space ?

BTW, I'm using the lastest CircleOS 4.x release.

Thanks in advance for any tips on this subject.

Joseph

Offline

 

# 19   2010-10-11 06:46:45 ADC and CircleOS

yrt
Administrator
From: Grenoble-France
Registered: 2008-06-11
Posts: 520
Website

Re: ADC and CircleOS

Hi Joseph,

The Primer2_Circle.elf is used only for the debug informations it contains. Applications and CircleOS are linked independently : the CircleOS is not provided as a library.
Effectively, if you need some ST library functions in order to manage peripherals not managed by the CircleOS API's, some functions will be duplicated in flash. If you load several applications into the flash, you multiply several times this fact.
It is the price to pay for the CircleOS, for its dynamical multi applications system.

Yves

Offline

 

# 20   2010-10-11 19:07:15 ADC and CircleOS

jreveane
New member
Registered: 2010-06-25
Posts: 7

Re: ADC and CircleOS

Hi Yves,

Thanks a lot for your quick reply, it does help.
I do understand the drawbacks for the support of  dynamic loading of multiple applications
and that I will need to duplicate some of the code (ADC, GPIO) which  is not shared by CircleOS.
However, I don't understand then the "magic" for the other calls provided by the CircleOS API
such as DRAW_xxxx() and so on ?
How are these calls different then ? Is there any special linker file for this ?
Thanks.

/joseph

Offline

 

# 21   2010-10-12 07:16:17 ADC and CircleOS

yrt
Administrator
From: Grenoble-France
Registered: 2008-06-11
Posts: 520
Website

Re: ADC and CircleOS

Effectively, the tool "circle_manager" called by the script "add to circle.bat" links the "application.o" with a special linker script, before download into the Primer, in order to move the application to the free flash area (depending on the already loaded applications).

Concerning the API, it is an array of function pointers. The "circle_API.h" provides the external variable "ptrCircle_API", which is the entry point of the API. It is a fix address (0x8000100) provided during the link by the file "{Ride}\Lib\ARM\CircleOS\Application_Startup.o", that is the startup configuration of the application Ride project.

This is also the startup file that locates the addresses of the name, of the init and the handler functions of the application at the 4 first words of the application flash area, in order to provide them to the CircleOS.

Yves

Offline

 

# 22   2010-10-12 18:32:54 ADC and CircleOS

jreveane
New member
Registered: 2010-06-25
Posts: 7

Re: ADC and CircleOS

Hi Yves,

Thanks for your explanations, this does help  a lot.
I had also a look at the new revision of the CircleOS Conception document,
it provides also very useful information.

/joseph

Offline

 

Board footer