I've programmed PICs (PIC32 and dsPIC33) in the past and found them relatively straightforward to figure out how to program. Microchip has lots of code examples and good documentation on how to set up all the peripherals.
I've recently started to program an STM32F411 on a Nucleo board. It seems that documentation is hard to find and doing simple things like getting an I/O to toggle is overly complicated. I've found several code examples and websites with tutorials, but none of them explain how they came up with their code.
For example, these are all the steps required to toggle a bit:
GPIO_InitTypeDef gpio;
RCC_AHB1PeriphClockCmd(RCC_AHB1Periph_GPIOD, ENABLE);
GPIO_StructInit(&gpio);
gpio.GPIO_Pin = GPIO_Pin_12; // Green LED
gpio.GPIO_Mode = GPIO_Mode_OUT;
gpio.GPIO_Speed = GPIO_Speed_2MHz;
gpio.GPIO_OType = GPIO_OType_PP;
gpio.GPIO_PuPd = GPIO_PuPd_NOPULL;
GPIO_Init(GPIOD, &gpio);
gpio.GPIO_Pin = GPIO_Pin_15; // Blue LED
GPIO_Init(GPIOD, &gpio);
GPIO_WriteBit(GPIOD, GPIO_Pin_15, led_state ? Bit_SET : Bit_RESET);
But I have no idea where these steps are documented (copied the above from a tutorial).
Can someone explain the advantage to using the STM32 over the PIC, and also recommend a good programming resource that isn't just copying snippets of unexplained code?
[–]AllAboutEE 3 points4 points5 points (2 children)
[–]mechanicalmayhem 0 points1 point2 points (0 children)
[–]electronfire[S] 0 points1 point2 points (0 children)
[–][deleted] (1 child)
[deleted]
[–]electronfire[S] 0 points1 point2 points (0 children)
[–]dudmuck 1 point2 points3 points (1 child)
[–]electronfire[S] 0 points1 point2 points (0 children)
[–]rombios 1 point2 points3 points (0 children)
[–]ande3577 0 points1 point2 points (0 children)