I have been working with the STM8L152R8 development board, but it does not seem to let me blink LD2 (which should be mapped to PB5) or really change any value at all. Here is my code. Thanks!
#include <stdint.h>
#define PB_ODR *(volatile uint8_t *)0x5005
#define PB_DDR *(volatile uint8_t *)0x5007
#define PB_CR1 *(volatile uint8_t *)0x5008
#define PB_CR2 *(volatile uint8_t *)0x5009
#define CLK_DIVR *(volatile uint8_t *)0x50c0
unsigned char i;
void main(void)
{
CLK_DIVR = 0x00; // Set the frequency to 16 MHz
PB_ODR = 0;
PB_DDR = 1 << 5;
PB_CR1 = 1 << 5;
while(1)
{
PB_ODR ^= 1 << 5;
for(i = 0; i < 15000; i++){}
}
}
I have also tried setting the registers to 0xFF to see if anything turns on, but I'm not getting any voltage out.
1 Answer 1
I was not flashing the program correctly, a lot of the tutorials I used I think were fine. I needed to be flashing it to RAM instead of programming the tab.
Sign up to request clarification or add additional context in comments.
2 Comments
tl-photography.at
What do you mean with "flashing to RAM"? You either flash the memory or load the program to RAM.
Community
As it’s currently written, your answer is unclear. Please edit to add additional details that will help others understand how this addresses the question asked. You can find more information on how to write good answers in the help center.
lang-c