Cortex M3 OCM3U: Unterschied zwischen den Versionen

Aus der Mikrocontroller.net Artikelsammlung, mit Beiträgen verschiedener Autoren (siehe Versionsgeschichte)
Wechseln zu: Navigation, Suche
K (Textersetzung - „<syntaxhighlight>“ durch „</syntaxhighlight>“)
 
(17 dazwischenliegende Versionen von 7 Benutzern werden nicht angezeigt)
Zeile 1: Zeile 1:
''von Theborg0815''
''von Theborg0815''
'''Achtung! Der Schaltplan ist fehlerhaft und entspricht NICHT der von ST empfohlenen Beschaltung!'''


ACHTUNG !!! Artikel in Arbeit.
ACHTUNG !!! Artikel in Arbeit.
Zeile 17: Zeile 19:
=== Features ===
=== Features ===


* Quarze für RTC und Takt
* Quarze für RTC und Hauptoszillator
* wenig Extrabeschaltung
* wenig Extrabeschaltung
* RS232 zum programmieren und für Datenübermittlung zum PC
* RS232 zum programmieren und für Datenübermittlung zum PC
* STM32F101C8T6, 2.0-3.6V, 5V Tolerante I/Os, max. 36MHz, 32Kb Flash, 6Kb SRAM, 2x16Bit Timer, 2xSPI, 2xI2C, 3xUART, 10x12Bit ADC, 26xGPIOs,1xRTC.
* STM32F101C8T6, 2.0-3.6V, 5V Tolerante I/Os, max. 36MHz, 32KB Flash, 6KB SRAM, 2x16Bit Timer, 2xSPI, 2xI2C, 3xUART, 10x12Bit ADC, 26xGPIOs, 1xRTC.
* Größere Modelle im pinkompatiblen Gehäuse erhältlich
* Größere Modelle im pinkompatiblen Gehäuse erhältlich


Zeile 27: Zeile 29:
Dieses kleine Beispiel schaltetet den Kompletten PortB
Dieses kleine Beispiel schaltetet den Kompletten PortB


<pre>
<syntaxhighlight lang="c">
/* Includes ------------------------------------------------------------------*/
/* Includes ------------------------------------------------------------------*/
#include "stm32f10x_it.h"
#include "stm32f10x_it.h"
Zeile 75: Zeile 77:
   while (1)
   while (1)
   {
   {
     /* Turn on led connected to PB.0 pin */
     /* Turn on led connected to PB */
     GPIO_SetBits(GPIOB, GPIO_Pin_All);
     GPIO_SetBits(GPIOB, GPIO_Pin_All);
     /* Insert delay */
     /* Insert delay */
     Delay(0xFFFFF);
     Delay(0xFFFFF);


     /* Turn off led connected to PB.0 pin */
     /* Turn off led connected to PB */
     GPIO_ResetBits(GPIOB, GPIO_Pin_All);
     GPIO_ResetBits(GPIOB, GPIO_Pin_All);
     /* Insert delay */
     /* Insert delay */
Zeile 194: Zeile 196:
}
}
#endif
#endif
</pre>
</syntaxhighlight>


== Bauteile Liste ==
== Bauteilliste ==


{|
{| border="1"
|-
|-
! Stück || Wert || Bauteile || Bauform || Reichelt-B-nr.
! Stück || Wert || Bauteile || Bauform || Reichelt Bestellnummer
|-
|-
| 4
| 4
Zeile 218: Zeile 220:
| Bat.-Fassung
| Bat.-Fassung
| -
| -
| KZH-25-1 (Passende Batterie:CR 2477)
| KZH-12-1 (Passende Batterie:CR 1216)
|-
|-
| 1
| 1
Zeile 231: Zeile 233:
| -
| -
| 1x SL 1X36G 2,54
| 1x SL 1X36G 2,54
|-
| 1
| -
| Pinheader 1x2
| -
| ^^
|-
|-
| 1
| 1
Zeile 261: Zeile 269:
| F09HP
| F09HP
| D-SUB BU 09US
| D-SUB BU 09US
|-
| 1
| 47k
| Widerstand
| 0805
| SMD-0805 47,0K
|}
|}
  Work in Prozess !!!
  Work in Process!


== Downloads ==
== Downloads ==


* Sourcecode: NA
* Sourcecode: [[Media:OCM3U-src-1.1.tar.gz]] (ST-lib,Ride7 Projektfiles, Makefile für CodeSourcery und Configs für OpenOCD) UPDATE: 21.11.2008
* Schaltplan: [[Media:OCM3U-rev-1.1.tar.gz]] UPDATE: 21.11.2008
* Schaltplan: [[Media:OCM3U-rev-1.0.tar.gz]] UPDATE: 07.11.2008
* Schaltplan: [[Media:OCM3U-rev-1.0.tar.gz]] UPDATE: 07.11.2008


== Siehe auch ==
== Siehe auch ==
* Diskussion zu diesem Projekt: NA
* Diskussion zu diesem Projekt: NA
* Artikel zum [[STM32]]. Installation und Downlaods sind hier beschrieben.


== Links ==
== Links ==
Zeile 276: Zeile 292:
* Examples: http://www.siwawi.arubi.uni-kl.de/avr_projects/arm_projects/index_cortex.html
* Examples: http://www.siwawi.arubi.uni-kl.de/avr_projects/arm_projects/index_cortex.html
* Infos und Architektur: http://www.arm.com/products/CPUs/ARM_Cortex-M3.html
* Infos und Architektur: http://www.arm.com/products/CPUs/ARM_Cortex-M3.html
[[Category:ARM]]
* Compiler von CodeSourcery: http://www.codesourcery.com/gnu_toolchains/arm/download.html (EABI)
 
[[Category:ARM-Boards]]

Aktuelle Version vom 23. Juni 2013, 21:26 Uhr

von Theborg0815

Achtung! Der Schaltplan ist fehlerhaft und entspricht NICHT der von ST empfohlenen Beschaltung!

ACHTUNG !!! Artikel in Arbeit.

OCM3U
OCM3U
OCM3U
OCM3U

Einleitung

Wer mal in die Welt der ST Cortex M3 schauen möchte, sollte sich das folgende Board mal anschauen. Es ist nichts Aufwendiges, nur das Wichtigste ist auf dem Board integriert. Aus Platzgründen habe ich auch den JTAG weggelassen, da der verwendete STM32F101 mit integriertem Bootloader daher kommt und sich über RS232 programmieren lässt, was für den Anfang reichen sollte. Zudem habe ich auch auf Sachen wie Spannungsregler und co. verzichtet, da hier jeder andere Vorstellungen hat. Zusätzlich ist es so gebaut, daß es auf ein Steckbrett passt.

Verbesserungen sind natürlich wie immer erwünscht.

--> Anmerkung: In den Diskussionsbereich verschoben, werde ich mich darum kümmern sobald ich die Zeit finde.

Features

  • Quarze für RTC und Hauptoszillator
  • wenig Extrabeschaltung
  • RS232 zum programmieren und für Datenübermittlung zum PC
  • STM32F101C8T6, 2.0-3.6V, 5V Tolerante I/Os, max. 36MHz, 32KB Flash, 6KB SRAM, 2x16Bit Timer, 2xSPI, 2xI2C, 3xUART, 10x12Bit ADC, 26xGPIOs, 1xRTC.
  • Größere Modelle im pinkompatiblen Gehäuse erhältlich

Software

Dieses kleine Beispiel schaltetet den Kompletten PortB

/* Includes ------------------------------------------------------------------*/
#include "stm32f10x_it.h"

/* Private typedef -----------------------------------------------------------*/
/* Private define ------------------------------------------------------------*/
/* Private macro -------------------------------------------------------------*/
/* Private variables ---------------------------------------------------------*/
GPIO_InitTypeDef GPIO_InitStructure;
ErrorStatus HSEStartUpStatus;

/* Private function prototypes -----------------------------------------------*/
void RCC_Configuration(void);
void NVIC_Configuration(void);
void Delay(vu32 nCount);

/* Private functions ---------------------------------------------------------*/

/*******************************************************************************
* Function Name  : main
* Description    : Main program.
* Input          : None
* Output         : None
* Return         : None
*******************************************************************************/
int main(void)
{
#ifdef DEBUG
  debug();
#endif

  /* Configure the system clocks */
  RCC_Configuration();
    
  /* NVIC Configuration */
  NVIC_Configuration();

  /* Enable GPIOB clock */
  RCC_APB2PeriphClockCmd(RCC_APB2Periph_GPIOB, ENABLE);
  
  /* Configure PB.0 as Output push-pull */
  GPIO_InitStructure.GPIO_Pin = GPIO_Pin_All;
  GPIO_InitStructure.GPIO_Speed = GPIO_Speed_10MHz;
  GPIO_InitStructure.GPIO_Mode = GPIO_Mode_Out_PP;
  GPIO_Init(GPIOB, &GPIO_InitStructure);

  while (1)
  {
    /* Turn on led connected to PB */
    GPIO_SetBits(GPIOB, GPIO_Pin_All);
    /* Insert delay */
    Delay(0xFFFFF);

    /* Turn off led connected to PB */
    GPIO_ResetBits(GPIOB, GPIO_Pin_All);
    /* Insert delay */
    Delay(0xFFFFF);
  }
}

/*******************************************************************************
* Function Name  : RCC_Configuration
* Description    : Configures the different system clocks.
* Input          : None
* Output         : None
* Return         : None
*******************************************************************************/
void RCC_Configuration(void)
{
  /* RCC system reset(for debug purpose) */
  RCC_DeInit();

  /* Enable HSE */
  RCC_HSEConfig(RCC_HSE_ON);

  /* Wait till HSE is ready */
  HSEStartUpStatus = RCC_WaitForHSEStartUp();

  if(HSEStartUpStatus == SUCCESS)
  {
    /* Enable Prefetch Buffer */
    FLASH_PrefetchBufferCmd(FLASH_PrefetchBuffer_Enable);

    /* Flash 2 wait state */
    FLASH_SetLatency(FLASH_Latency_2);
 	
    /* HCLK = SYSCLK */
    RCC_HCLKConfig(RCC_SYSCLK_Div1); 
  
    /* PCLK2 = HCLK */
    RCC_PCLK2Config(RCC_HCLK_Div1); 

    /* PCLK1 = HCLK/2 */
    RCC_PCLK1Config(RCC_HCLK_Div2);

    /* PLLCLK = 8MHz * 4 = 32 MHz */
    RCC_PLLConfig(RCC_PLLSource_HSE_Div1, RCC_PLLMul_4);

    /* Enable PLL */ 
    RCC_PLLCmd(ENABLE);

    /* Wait till PLL is ready */
    while(RCC_GetFlagStatus(RCC_FLAG_PLLRDY) == RESET)
    {
    }

    /* Select PLL as system clock source */
    RCC_SYSCLKConfig(RCC_SYSCLKSource_PLLCLK);

    /* Wait till PLL is used as system clock source */
    while(RCC_GetSYSCLKSource() != 0x08)
    {
    }
  }
}

/*******************************************************************************
* Function Name  : NVIC_Configuration
* Description    : Configures Vector Table base location.
* Input          : None
* Output         : None
* Return         : None
*******************************************************************************/
void NVIC_Configuration(void)
{
#ifdef  VECT_TAB_RAM  
  /* Set the Vector Table base location at 0x20000000 */ 
  NVIC_SetVectorTable(NVIC_VectTab_RAM, 0x0); 
#else  /* VECT_TAB_FLASH  */
  /* Set the Vector Table base location at 0x08000000 */ 
  NVIC_SetVectorTable(NVIC_VectTab_FLASH, 0x0);   
#endif
}

/*******************************************************************************
* Function Name  : Delay
* Description    : Inserts a delay time.
* Input          : nCount: specifies the delay time length.
* Output         : None
* Return         : None
*******************************************************************************/
void Delay(vu32 nCount)
{
  for(; nCount != 0; nCount--);
}

#ifdef  DEBUG
/*******************************************************************************
* Function Name  : assert_failed
* Description    : Reports the name of the source file and the source line number
*                  where the assert_param error has occurred.
* Input          : - file: pointer to the source file name
*                  - line: assert_param error line source number
* Output         : None
* Return         : None
*******************************************************************************/
void assert_failed(u8* file, u32 line)
{ 
  /* User can add his own implementation to report the file name and line number,
     ex: printf("Wrong parameters value: file %s on line %d\r\n", file, line) */

  /* Infinite loop */
  while (1)
  {
  }
}
#endif

Bauteilliste

Stück Wert Bauteile Bauform Reichelt Bestellnummer
4 22pF Kondensator 0805 NPO-G0805 22P
5 100nF Kondensator 0805 X7R-G0805 100N
1 - Bat.-Fassung - KZH-12-1 (Passende Batterie:CR 1216)
1 - MAX3232ECWE SO16L -
2 - Pinheader 1x16 - 1x SL 1X36G 2,54
1 - Pinheader 1x2 - ^^
1 32.768Khz Crystal HC49UP -
1 8Mhz Crystal HC49UP 8,0000-HC49-SMD
1 - Switch - TASTER 9312
1 - STM32F101C8T6 LQFP48 -
1 - SUBD-CON. F09HP D-SUB BU 09US
1 47k Widerstand 0805 SMD-0805 47,0K
Work in Process!

Downloads

Siehe auch

  • Diskussion zu diesem Projekt: NA
  • Artikel zum STM32. Installation und Downlaods sind hier beschrieben.

Links