2017-02-19 11:31 AM
2017-02-19 05:08 PM
Read the RM0090 Reference Manual and understand the bit level functionality of the peripheral registers.
For the Cortex-M4 ARM has a TRM, and Joseph Yiu has a series of books that provide alternate perspective.
Have you any other experience programming micro-controllers at this level? Can you leverage that knowledge?
2017-02-20 09:37 AM
I have programmed 8051 series, pic16f series using registers, I have also used Tiva c(Tm4c123 & Tm4c1294 Launchpads) but for that I used spl in code composer studio so I have no basic Idea of programming ARM using registers.
Also,How to set Keil run time environment for register level programming?
Thank You.
2017-02-20 10:14 AM
Can you pull in the stm32f4xx.h, or equivalent, file and use peripheral register structures?
ie
VTOR->SCB = 0x08000000;
or
if (USART1->SR & 0x80) // TXE
USART1->DR = 0x55;
You could create pointers at specific addresses if that is the way you want to do it.
2017-02-20 11:33 AM
Yes sort of!!!!
Thanks for the Help.
2017-02-20 04:56 PM
+1 to all Clive said above, except the example
SCB->VTOR = 0x08000000;
orif (USART1->SR & USART_SR_TXE) // TXE USART1->DR = 0x55;;)
I recommend to avoid the 'magic numbers'. IMO it's better to use the symbols defined in the headers. Unfortunately, ST doesn't properly define values for non-single-bit fields int he registers (I try to pester them for this at all possible occasions :) ) so I augment my headers.
If you have an STM32F4 DISCO or the related EVAL, this snippet - www.efton.sk/STM32/b.c demonstrates blinking LEDS using timer. (Augmented header www.efton.sk/STM32/stm32f4xx.zip - it's an older version of the header so don't use it for your work, I just give it here as the example of the augmentations). I threw clock or any other than the default C memory clear/init out of my startup code; I know it's there on ARMs insistence but IMO it does not belong there, I do all clocks etc. inits wherever I find it appropriate, usually at the beginning of main().
I don't use Keil (I use CodeBlocks with EPSDebugger, or just plain gcc at times with a simplistic programmers' editor I prefer), so can't speak for that, sorry.
My 2eurocents.
JW
2017-02-20 05:04 PM
Trying to gauge the level of no library I'm playing to.
2017-02-20 07:19 PM
I also recommend treating the libraries provided by ST (SPL or HAL) as coding examples.
This may save you some debugging time when accessing the hardware when a specific register access mode is required ( like for example 16-bit access or when read-modify-write operation should be avoided )
Max