Blue pill and CANbus
Posted: Mon Nov 08, 2021 7:38 am
I'm trying to find an example of using CAN bus, with libraries for a blue pill.. I found an instructable but they only showed the hardware setup and didn't link to any libraries.. I've looked at libraries and there's nothing that's kinda complete, I've downloaded dozens now, including the Arduino-STM32-CAN-master and nothing wants to work, getting pretty frustrating
Here's the error list from trying to compile the example
Here's the error list from trying to compile the example
Code: Select all
Arduino: 1.8.13 (Windows 7), Board: "Generic STM32F103C series, STM32F103CB (20k RAM. 128k Flash), STM32duino bootloader, 72Mhz (Normal), Smallest (default)"
C:\Users\Y2D\Documents\Arduino\libraries\Arduino-STM32-CAN-master\stm32f103\stm32f103.ino: In function 'void CANSetFilter(uint8_t, uint8_t, uint8_t, uint8_t, uint32_t, uint32_t)':
stm32f103:63:3: error: 'CAN1' was not declared in this scope
CAN1->FA1R &= ~(0x1UL<<index); // Deactivate filter
^
C:\Users\Y2D\Documents\Arduino\libraries\Arduino-STM32-CAN-master\stm32f103\stm32f103.ino: In function 'bool CANInit(BITRATE, int)':
stm32f103:105:3: error: 'RCC' was not declared in this scope
RCC->APB1ENR |= 0x2000000UL; // Enable CAN clock
^
stm32f103:107:3: error: 'AFIO' was not declared in this scope
AFIO->MAPR &= 0xFFFF9FFF; // reset CAN remap
^
stm32f103:112:12: error: 'struct gpio_dev' has no member named 'CRH'
GPIOA->CRH &= ~(0xFF000UL); // Configure PA12(0b0000) and PA11(0b0000)
^
stm32f103:117:12: error: 'struct gpio_dev' has no member named 'CRH'
GPIOA->CRH |= 0xB8FFFUL; // Configure PA12(0b1011) and PA11(0b1000)
^
stm32f103:125:12: error: 'struct gpio_dev' has no member named 'ODR'
GPIOA->ODR |= 0x1UL << 12; // PA12 Upll-up
^
stm32f103:134:12: error: 'struct gpio_dev' has no member named 'CRH'
GPIOB->CRH &= ~(0xFFUL); // Configure PB9(0b0000) and PB8(0b0000)
^
stm32f103:139:12: error: 'struct gpio_dev' has no member named 'CRH'
GPIOB->CRH |= 0xB8UL; // Configure PB9(0b1011) and PB8(0b1000)
^
stm32f103:147:12: error: 'struct gpio_dev' has no member named 'ODR'
GPIOB->ODR |= 0x1UL << 8; // PB8 Upll-up
^
stm32f103:155:12: error: 'struct gpio_dev' has no member named 'CRL'
GPIOD->CRL &= ~(0xFFUL); // Configure PD1(0b0000) and PD0(0b0000)
^
stm32f103:160:12: error: 'struct gpio_dev' has no member named 'CRH'
GPIOD->CRH |= 0xB8UL; // Configure PD1(0b1011) and PD0(0b1000)
^
stm32f103:168:12: error: 'struct gpio_dev' has no member named 'ODR'
GPIOD->ODR |= 0x1UL << 0; // PD0 Upll-up
^
stm32f103:171:3: error: 'CAN1' was not declared in this scope
CAN1->MCR |= 0x1UL; // Require CAN1 to Initialization mode
^
C:\Users\Y2D\Documents\Arduino\libraries\Arduino-STM32-CAN-master\stm32f103\stm32f103.ino: In function 'void CANReceive(CAN_msg_t*)':
stm32f103:243:17: error: 'CAN1' was not declared in this scope
uint32_t id = CAN1->sFIFOMailBox[0].RIR;
^
C:\Users\Y2D\Documents\Arduino\libraries\Arduino-STM32-CAN-master\stm32f103\stm32f103.ino: In function 'void CANSend(CAN_msg_t*)':
stm32f103:301:3: error: 'CAN1' was not declared in this scope
CAN1->sTxMailBox[0].TDTR &= ~(0xF);
^
C:\Users\Y2D\Documents\Arduino\libraries\Arduino-STM32-CAN-master\stm32f103\stm32f103.ino: In function 'uint8_t CANMsgAvail()':
stm32f103:337:10: error: 'CAN1' was not declared in this scope
return CAN1->RF0R & 0x3UL;
^
exit status 1
'CAN1' was not declared in this scope
Invalid library found in C:\Users\Y2D\Documents\Arduino\libraries\Arduino-STM32-CAN-master: no headers files (.h) found in C:\Users\Y2D\Documents\Arduino\libraries\Arduino-STM32-CAN-master
This report would have more information with
"Show verbose output during compilation"
option enabled in File -> Preferences.