@@ -31,7 +31,7 @@ Nucleo-F429ZI.
3131
3232| Skeleton project | MCU datasheet | Board datasheet | Status |
3333| --------- | ---------------- | ------------- | ------------ |
34- | [ STM32 Nucleo-F429ZI] ( step-7-webserver/nucleo-f429zi/ ) | [ mcu datasheet] ( https://www.st.com/resource/en/reference_manual/dm00031020-stm32f405-415-stm32f407-417-stm32f427-437-and-stm32f429-439-advanced-arm-based-32-bit-mcus-stmicroelectronics.pdf ) | [ board datasheet] ( https//www.st.com/resource/en/user_manual/dm00244518-stm32-nucleo144-boards-mb1137-stmicroelectronics.pdf ) | complete |
34+ | [ STM32 Nucleo-F429ZI] ( step-7-webserver/nucleo-f429zi/ ) | [ mcu datasheet] ( https://www.st.com/resource/en/reference_manual/dm00031020-stm32f405-415-stm32f407-417-stm32f427-437-and-stm32f429-439-advanced-arm-based-32-bit-mcus-stmicroelectronics.pdf ) | [ board datasheet] ( https: //www.st.com/resource/en/user_manual/dm00244518-stm32-nucleo144-boards-mb1137-stmicroelectronics.pdf ) | complete |
3535| [ TI EK-TM4C1294XL] ( step-7-webserver/ek-tm4c1294xl/ ) | [ mcu datasheet] ( https://www.ti.com/lit/ds/symlink/tm4c1294ncpdt.pdf ) | [ board datasheet] ( https://www.ti.com/lit/ug/spmu365c/spmu365c.pdf ) | complete |
3636| [ RP2040 Pico-W5500] ( step-7-webserver/pico-w5500/ ) | [ mcu datasheet] ( https://datasheets.raspberrypi.com/rp2040/rp2040-datasheet.pdf ) | [ board datasheet] ( https://docs.wiznet.io/Product/iEthernet/W5500/w5500-evb-pico ) | complete |
3737
@@ -764,7 +764,7 @@ int main(void) {
764764 uint16_t led = PIN(' B' , 7); // Blue LED
765765 RCC->AHB1ENR |= BIT(PINBANK(led)); // Enable GPIO clock for LED
766766 gpio_set_mode(led, GPIO_MODE_OUTPUT); // Set blue LED to output mode
767- for (;;) asm volatile("nop"); // Infinite loop
767+ for (;;) (void) 0; // Infinite loop
768768 return 0;
769769}
770770```
@@ -779,7 +779,7 @@ register (i.e. set pin low). Let's define an API function for that:
779779` ` ` c
780780static inline void gpio_write(uint16_t pin, bool val) {
781781 struct gpio * gpio = GPIO(PINBANK(pin));
782- gpio-> BSRR | = (1U << PINNO(pin)) << (val ? 0 : 16);
782+ gpio-> BSRR = (1U << PINNO(pin)) << (val ? 0 : 16);
783783}
784784` ` `
785785
@@ -789,7 +789,7 @@ a NOP instruction a given number of times:
789789
790790```c
791791static inline void spin(volatile uint32_t count) {
792- while (count--) asm("nop") ;
792+ while (count--) (void) 0 ;
793793}
794794```
795795
@@ -932,7 +932,7 @@ Now we are ready to update our main loop and use a precise timer for LED blink.
932932For example, let' s use 250 milliseconds blinking interval:
933933
934934` ` ` c
935- uint32_t timer, period = 250 ; // Declare timer and 250ms period
935+ uint32_t timer, period = 500 ; // Declare timer and 500ms period
936936 for (;; ) {
937937 if (timer_expired(& timer, period, s_ticks)) {
938938 static bool on; // This block is executed
@@ -1019,16 +1019,16 @@ Now we're ready to create a UART initialization API function:
10191019#define FREQ 16000000 // CPU frequency, 16 Mhz
10201020static inline void uart_init(struct uart *uart, unsigned long baud) {
10211021 // https://www.st.com/resource/en/datasheet/stm32f429zi.pdf
1022- uint8_t af = 0 ; // Alternate function
1022+ uint8_t af = 7 ; // Alternate function
10231023 uint16_t rx = 0, tx = 0; // pins
10241024
10251025 if (uart == UART1) RCC->APB2ENR |= BIT(4);
10261026 if (uart == UART2) RCC->APB1ENR |= BIT(17);
10271027 if (uart == UART3) RCC->APB1ENR |= BIT(18);
10281028
1029- if (uart == UART1) af = 4, tx = PIN(' A' , 9), rx = PIN(' A' , 10);
1030- if (uart == UART2) af = 4, tx = PIN(' A' , 2), rx = PIN(' A' , 3);
1031- if (uart == UART3) af = 7, tx = PIN(' D' , 8), rx = PIN(' D' , 9);
1029+ if (uart == UART1) tx = PIN(' A' , 9), rx = PIN(' A' , 10);
1030+ if (uart == UART2) tx = PIN(' A' , 2), rx = PIN(' A' , 3);
1031+ if (uart == UART3) tx = PIN(' D' , 8), rx = PIN(' D' , 9);
10321032
10331033 gpio_set_mode(tx, GPIO_MODE_AF);
10341034 gpio_set_af(tx, af);
@@ -1156,7 +1156,7 @@ int main(void) {
11561156 systick_init(16000000 / 1000); // Tick every 1 ms
11571157 gpio_set_mode(led, GPIO_MODE_OUTPUT); // Set blue LED to output mode
11581158 uart_init(UART3, 115200); // Initialise UART
1159- uint32_t timer = 0, period = 250 ; // Declare timer and 250ms period
1159+ uint32_t timer = 0, period = 500 ; // Declare timer and 500ms period
11601160 for (;; ) {
11611161 if (timer_expired(& timer, period, s_ticks)) {
11621162 static bool on; // This block is executed
@@ -1364,7 +1364,7 @@ standard C inludes, vendor CMSIS include, defines to PIN, BIT, FREQ, and
13641364# define PINBANK(pin) (pin >> 8)
13651365
13661366static inline void spin(volatile uint32_t count) {
1367- while (count--) asm( " nop " ) ;
1367+ while (count--) (void) 0 ;
13681368}
13691369
13701370static inline bool timer_expired(uint32_t * t, uint32_t prd, uint32_t now) {
0 commit comments