2010-08-25 12:21 AM
STM32F103 Assembler
2011-05-17 05:04 AM
Not sure there is an ''assembler'' manual from ST, the STM32 uses the ARM Cortex M3 with a Thumb2 instruction set. Joseph Yiu's book would represent a good starting point, if the PDF/HTTP manuals from ARM don't suffice.
http://www.amazon.com/Definitive-Guide-ARM-Cortex-M3-Second/dp/185617963X/ref=sr_1_1?ie=UTF8&s=books&qid=1282751866&sr=8-1 The RM0008 STM32 Reference Manual would be a good starting point for register info including the timers. 13902.PDF as I recall. Peripheral registers access just like any other memory location on an ARM part. You will need to load the value into an ARM CPU register, and then mask/shift the bit(s) you want and do branches, comparisons, etc. Assembler doesn't provide the abstractions found in high level languages, you have to implement things in a more basic fashion. ldr r2, =0x40000400 ; TIM3 ldr.w r0, [r2, #16] ; TIMx_SR ands r0,#0x01 ; Mask Bit 0 (UIF) beq _uifclear bne _ufiset2011-05-17 05:04 AM
ARMv7-M Architecture Application Level Reference Manual (ARM DDI 0405B)
describes the instruction set2011-05-17 05:04 AM
I'll note that you can also do ''bit-banding'' access to peripheral registers, which might help for a single bit, less helpful for bits.
ldr r4, =0x42420000 ; BB 40021000.0 RCC Base movs r1, #1 str r1, [r4, #96] ; 42420060 BB -> 40021000.24=1 PLLON2011-05-17 05:04 AM
''I also have an other question is it possible to access the bits of an register directly?''
Yes, you can do that using bit banding.2011-05-17 05:04 AM
Hi,
Thanks for your help :) So I think bitbanding is the right for me, because i only want to change one bit. With the bitbanding only one bit is affected or? So all other bits in the register keep their status? And where do i find the adresses of the pheripherials? I searched in the programming manual and in the RM0008 but i havent found them. regards2011-05-17 05:04 AM
You will find the memory map for the peripherals in the data sheet for the chip that you are using. From this you can get the base address for the registers of a particular peripheral.
You will find the offsets of each register from base address in RM0008. Or they will be defined in header files provided with your development tools.2011-05-17 05:04 AM
Thanks, i found it :)