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?
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.
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?
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.
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.
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'
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.
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...
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" ?
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?
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.
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.
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?
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.
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 ?
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.
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.
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.
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.