<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="https://community.arm.com/utility/feedstylesheets/rss.xsl" media="screen"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:wfw="http://wellformedweb.org/CommentAPI/"><channel><title>Help on ADC channels</title><link>https://community.arm.com/developer/tools-software/tools/f/keil-forum/25085/help-on-adc-channels</link><description> 
Hi, 
I use a MCBSTM32E evaluation board, which is composed of an
STM32F103ZET6 MCU, and I loaded the measure example provided by Keil.
It works perfectly, but I want to add another variable resistor on
PC13 which is the channel 13 of ADC1. The onboard</description><dc:language>en-US</dc:language><generator>Telligent Community 10</generator><item><title>RE: Help on ADC channels</title><link>https://community.arm.com/thread/142214?ContentTypeID=1</link><pubDate>Tue, 03 Mar 2009 09:21:52 GMT</pubDate><guid isPermaLink="false">dd9e70c8-6d3c-4c71-b136-2456382a7b5c:6d36c9c4-ac0b-438b-ac41-28281abed113</guid><dc:creator>ImPer Westermark</dc:creator><description>&lt;p&gt;&lt;p&gt;
Several processors will drop the JTAG support when sleeping. The
sleep turns off clocking to too large sections of the processor,
making it inert until it receives an interrupt.&lt;/p&gt;
&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Help on ADC channels</title><link>https://community.arm.com/thread/139056?ContentTypeID=1</link><pubDate>Tue, 03 Mar 2009 07:32:52 GMT</pubDate><guid isPermaLink="false">dd9e70c8-6d3c-4c71-b136-2456382a7b5c:02c4818c-06ff-4160-8b24-2dc7e9cff0fc</guid><dc:creator>Gary Bisson</dc:creator><description>&lt;p&gt;&lt;p&gt;
Thank you. I did not know what was the SWJ, now I do. But I
encountered the same problem. I think it is each time the Cortex is
in sleep mode (I cannot access memory). I tried my infinite loop
without the __WFI() instruction and now I can load my programs
easily.&lt;/p&gt;
&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Help on ADC channels</title><link>https://community.arm.com/thread/135693?ContentTypeID=1</link><pubDate>Mon, 02 Mar 2009 23:07:32 GMT</pubDate><guid isPermaLink="false">dd9e70c8-6d3c-4c71-b136-2456382a7b5c:c783ef84-748e-4712-b1d2-fff79affb828</guid><dc:creator>Martin G&amp;#195;&amp;#188;nther</dc:creator><description>&lt;p&gt;&lt;p&gt;
Hello Gery Bisson,&lt;/p&gt;

&lt;p&gt;
I am not shure if this will help but you can try to use Serial
Wire Debug port instead of JATG.&lt;/p&gt;

&lt;p&gt;
If you are using a ULINK2/ULINK-ME than change the settings in
uVision for &lt;b&gt;Ulink Cortex Debugger&lt;/b&gt;. In &lt;b&gt;Cortex-M Target
Driver Setup&lt;/b&gt; check &lt;i&gt;SWJ&lt;/i&gt; and set port to &lt;i&gt;SW&lt;/i&gt;. If this
works you will see under &lt;i&gt;SW Device&lt;/i&gt; a IDCode.&lt;br /&gt;
Please see also &lt;a href="http://www.keil.com/support/man/docs/ulink2/ulink2_ctx_jtag_adapter.htm."&gt;
&lt;a href="http://www.keil.com/support/man/docs/ulink2/ulink2_ctx_jtag_adapter.htm."&gt;www.keil.com/.../ulink2_ctx_jtag_adapter.htm.&lt;/a&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;
Best Regards,&lt;br /&gt;
Martin Guenther&lt;/p&gt;
&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Help on ADC channels</title><link>https://community.arm.com/thread/125265?ContentTypeID=1</link><pubDate>Mon, 02 Mar 2009 08:16:20 GMT</pubDate><guid isPermaLink="false">dd9e70c8-6d3c-4c71-b136-2456382a7b5c:7c503381-5939-47f4-ad8d-46d72126c734</guid><dc:creator>Gary Bisson</dc:creator><description>&lt;p&gt;&lt;p&gt;
I come back to say that my problem is solved. It was a mistake
which came from a bad example. In fact, I had put
DMA1_Channel1_IRQHandler() as the prototype. It did not generate any
error during compilation, but the true one is
DAMChannel1_IRQHandler(). Now the DMA works perfectly.&lt;br /&gt;
But I have a new problem which is more hardware in fact. I &amp;quot;cannot
acces memory&amp;quot; when trying to load my program. I think I know why it
doesnt work anymore (probably because I used the pins A which are the
JTAG one). How can I reset the whole thing ?&lt;/p&gt;
&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Help on ADC channels</title><link>https://community.arm.com/thread/114706?ContentTypeID=1</link><pubDate>Mon, 23 Feb 2009 07:16:50 GMT</pubDate><guid isPermaLink="false">dd9e70c8-6d3c-4c71-b136-2456382a7b5c:66fb1570-bfcb-49a4-b87d-faed42c18d6d</guid><dc:creator>Gary Bisson</dc:creator><description>&lt;p&gt;&lt;p&gt;
I&amp;#39;m back on my problem. I made it work with DMA without
interrupts. It works well, it is quite simple to get data in an array
which size depends on the number of channels.&lt;br /&gt;
I did not find how to generate an interrupt from DMA to tell that the
transfer is done. I configured the DMA like this :&lt;/p&gt;

&lt;pre&gt;
  /* DMA1 channel1 configuration */
  DMA_DeInit(DMA1_Channel1);
  DMA_InitStructure.DMA_PeripheralBaseAddr = ADC1_DR_Address;
  DMA_InitStructure.DMA_MemoryBaseAddr = (u32)&amp;amp;ADC_result;
  DMA_InitStructure.DMA_DIR = DMA_DIR_PeripheralSRC;
  DMA_InitStructure.DMA_BufferSize = 2;
  DMA_InitStructure.DMA_PeripheralInc = DMA_PeripheralInc_Disable;
  DMA_InitStructure.DMA_MemoryInc = DMA_MemoryInc_Enable;
  DMA_InitStructure.DMA_PeripheralDataSize = DMA_PeripheralDataSize_HalfWord;
  DMA_InitStructure.DMA_MemoryDataSize = DMA_MemoryDataSize_HalfWord;
  DMA_InitStructure.DMA_Mode = DMA_Mode_Circular;
  DMA_InitStructure.DMA_Priority = DMA_Priority_High;
  DMA_InitStructure.DMA_M2M = DMA_M2M_Disable;
  DMA_Init(DMA1_Channel1, &amp;amp;DMA_InitStructure);
  /* Enable DMA1 channel1 */
  DMA_Cmd(DMA1_Channel1, ENABLE);
  DMA_ITConfig(DMA1_Channel1, DMA1_IT_TC1 , ENABLE);
&lt;/pre&gt;

&lt;p&gt;
&lt;br /&gt;
and the NVIC as below :&lt;/p&gt;

&lt;pre&gt;
  NVIC_SetVectorTable(NVIC_VectTab_FLASH, 0x0);
  NVIC_PriorityGroupConfig(NVIC_PriorityGroup_1);
  NVIC_DeInit(); /*Deinitializes the NVIC*/
  NVIC_SCBDeInit();
  NVIC_InitStructure.NVIC_IRQChannel = DMA1_Channel1_IRQChannel;
  NVIC_InitStructure.NVIC_IRQChannelPreemptionPriority = 1;
  NVIC_InitStructure.NVIC_IRQChannelSubPriority = 3;
  NVIC_InitStructure.NVIC_IRQChannelCmd = ENABLE;
  NVIC_Init(&amp;amp;NVIC_InitStructure);
&lt;/pre&gt;

&lt;p&gt;
&lt;br /&gt;
It seems to me that the problem comes from the NVIC because once it
is initialised, my Systick_IRQHandler (which is necessary in my case
to activate conversion every 10ms) runs only once and then doesnt
work anymore.&lt;br /&gt;
Do I need to put my systick interrupt in the NVIC structure ? I&amp;#39;ve
seen that this latter is automatically in it. If I need to, what is
the name of the IRQ_Channel because I tried SysTick but it did not
compiled. Is it a better solution to use a timer to get my 10ms
interrupt ?&lt;br /&gt;
Thanks in advance (again).&lt;/p&gt;

&lt;p&gt;
NB : Documents I read : Reference Manual (&lt;a href="http://www.st.com/stonline/products/literature/rm/13902.pdf"&gt;www.st.com/.../13902.pdf&lt;/a&gt;)&lt;br /&gt;

Insider&amp;#39;s Guide (&lt;a href="http://www.st.com/mcu/files/mcu/1221142709.pdf"&gt;www.st.com/.../1221142709.pdf&lt;/a&gt;)&lt;br /&gt;

FWLib (&lt;a href="http://www.st.com/stonline/products/literature/um/13475.pdf"&gt;www.st.com/.../13475.pdf&lt;/a&gt;)&lt;br /&gt;

STM32 Datasheet (&lt;a href="http://www.st.com/stonline/products/literature/ds/14611.pdf"&gt;www.st.com/.../14611.pdf&lt;/a&gt;)&lt;/p&gt;
&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Help on ADC channels</title><link>https://community.arm.com/thread/114704?ContentTypeID=1</link><pubDate>Fri, 20 Feb 2009 02:54:00 GMT</pubDate><guid isPermaLink="false">dd9e70c8-6d3c-4c71-b136-2456382a7b5c:4598183c-f086-4e6d-ad38-b871546ab9fc</guid><dc:creator>Gary Bisson</dc:creator><description>&lt;p&gt;&lt;p&gt;
Thank you, both of you. Per Westermark, your explanations were
clear thus I made a decision which is to first use only interrupts
and read the Cortex datasheet. I tried the __USE_IRQ in the C/C++
define and it worked. I&amp;#39;ll tell you when everything works.&lt;/p&gt;
&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Help on ADC channels</title><link>https://community.arm.com/thread/101648?ContentTypeID=1</link><pubDate>Thu, 19 Feb 2009 22:54:44 GMT</pubDate><guid isPermaLink="false">dd9e70c8-6d3c-4c71-b136-2456382a7b5c:9829146f-9522-4386-8707-d66a71511675</guid><dc:creator>Martin G&amp;#195;&amp;#188;nther</dc:creator><description>&lt;p&gt;&lt;p&gt;
Hello Gary Bisson,&lt;/p&gt;

&lt;p&gt;
Set __USE_IRQ in uVision under &lt;i&gt;options for target - C/C++ -
Define&lt;/i&gt;.&lt;/p&gt;

&lt;p&gt;
Best Regards,&lt;br /&gt;
Martin Guenther&lt;/p&gt;
&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Help on ADC channels</title><link>https://community.arm.com/thread/101650?ContentTypeID=1</link><pubDate>Thu, 19 Feb 2009 15:40:11 GMT</pubDate><guid isPermaLink="false">dd9e70c8-6d3c-4c71-b136-2456382a7b5c:02ea33b0-6b7d-4af2-a00d-828198e1cf08</guid><dc:creator>Per Westermark</dc:creator><description>&lt;p&gt;&lt;p&gt;
Interrupts and DMA are two separate mechanisms.&lt;/p&gt;

&lt;p&gt;
You may use:&lt;br /&gt;
- no interrupts, no DMA. Just poll the ADC.&lt;br /&gt;
- no interrupts but DMA. Poll DMA or ADC when a full DMA transfer is
done (all channels processed).&lt;br /&gt;
- interrupts for each individual read, without use of DMA.&lt;br /&gt;
- interrupts together with DMA - you get the interrupt when all
enabled channels have been processed (and DMA have written the values
into an array).&lt;/p&gt;

&lt;p&gt;
If you are going to change existing code (or write new) then you
must read the datasheet for the processor - especially the settings
available for the DMA unit (if you decide to use DMA), the ADC and
the interrupt logic (if you decide to use interrupts).&lt;/p&gt;

&lt;p&gt;
In the end, there are almost always multiple ways to solve a
problem. In your case, you must choose if you want to use interrupts
or not and if you want to use DMA or not. If you do use DMA then you
will have to configure it to step the destination address, since it
isn&amp;#39;t meaningful to use DMA for reading from ADC to memory unless you
step the address. Either because you want multiple samples from one
channel. Or you want one sample each from multiple channels. Without
activating the destination step function, you would just overwrite
the previous value. How you do it is described in the datasheet. If
you want to use DMA is something you must decide.&lt;/p&gt;

&lt;p&gt;
If you want to use interrupts, you may normally configure to get
one interrupt for each ADC read, or one interrupt for each full pass
through all activated ADC channels. How you do is mentioned in the
datasheets. If you want to do it is something you must decide.&lt;/p&gt;

&lt;p&gt;
If you want to poll the ADC to check if a value is ready (i.e.
skip interrupts and DMA) the required information is in the
datasheet. The decision to do this is up to you.&lt;/p&gt;

&lt;p&gt;
If you want to use DMA and poll the DMA unit to check when a full
DMA burst is done, then the datasheet should tell how to check the
running state of the DMA unit. The decision if this is a good
solution for your application is obviously up to you.&lt;/p&gt;

&lt;p&gt;
What I would recommend is that you do your best to get it to work.
Then post a reference to a named datasheet and tell what part of that
text you don&amp;#39;t understand. And/or a sample code that you have
designed (based on information in examples and the datasheet) and
what you think the code does, and what it actually does. Then people
may comment about code lines where you might have misunderstood
something, or where you might have forgotten required steps.&lt;/p&gt;

&lt;p&gt;
About defining symbols to control your compilation (__USE_IRQ),
you can open your target options and then select the tab &amp;quot;C/C++&amp;quot;. The
top text is &amp;quot;Preprocessor Symbols&amp;quot; and the first field is labeled
&amp;quot;Define&amp;quot;.&lt;/p&gt;

&lt;p&gt;
If you write a symbol name there, you will directly see your
compiler command line update in the bottom-most field of the tab.&lt;/p&gt;

&lt;p&gt;
The tab &amp;quot;Asm&amp;quot; have similar fields for controlling symbols used
together with assembler files.&lt;/p&gt;
&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Help on ADC channels</title><link>https://community.arm.com/thread/77181?ContentTypeID=1</link><pubDate>Thu, 19 Feb 2009 13:31:48 GMT</pubDate><guid isPermaLink="false">dd9e70c8-6d3c-4c71-b136-2456382a7b5c:5446d7cb-329d-4101-a6d9-9b4c75046cf4</guid><dc:creator>Gary Bisson</dc:creator><description>&lt;p&gt;&lt;p&gt;
Ok, thanks a lot. That is exactly what I wanted to know, how the
DMA should proceed to store two values. But the point is that I found
that on the example &amp;quot;Measure&amp;quot; from Keil doesnt use the IRQ. In fact
for each instruction which concerns interruptions there are
conditions if(n)def __USE_IRQ which permit to use it or not. I did
not find where to put &amp;quot;__USE_IRQ&amp;quot; in order to activate
interuptions...&lt;/p&gt;
&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Help on ADC channels</title><link>https://community.arm.com/thread/55456?ContentTypeID=1</link><pubDate>Thu, 19 Feb 2009 09:08:52 GMT</pubDate><guid isPermaLink="false">dd9e70c8-6d3c-4c71-b136-2456382a7b5c:c838ba1d-11df-44ae-bc5f-e9b4852d5b38</guid><dc:creator>Per Westermark</dc:creator><description>&lt;p&gt;&lt;p&gt;
I don&amp;#39;t know your specific processor, but I would guess that your
DMA module have a flag that you need to set to activate the
destination increment, i.e. that it steps forward the destination
address for each transfer.&lt;/p&gt;

&lt;p&gt;
The DMA unit normally needs one flag for source increment and one
for destination increment, to handle the cases for the
source/destination is meory (should increment) or is the data
register of an I/O device (should not increment).&lt;/p&gt;
&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>