!ACHTUNG! READ FIRST COPYRIGHT ISSUE
Target hardware: Blue Pill board
Pinout:
PIN/PINS | DESCRIPTION |
---|---|
PA11/PA12 | USB FS DM/DP |
PC13 | Status LED |
Works with PEAK PCAN-View in Windows
Before connecting the device to the USB port, the following must be done in the PCAN-View window:
- All transmissions must be disabled.
- PCAN-View program must be disconnected from PCAN hardware.
Otherwise for unknown reasons there is a failure in USB connection.
Inside pcan_protocol_process_data() function fields pmsg->size and pmsg->type are zero.
Toolchain: GNU Arm Embedded Toolchain
It is possible to build firmware with STM32CubeIDE project (I used version 1.12.1) or make.
Limitations.
- Clock Frequency must be 40 MHz.
- Error Generator does not work.
It is possible to use the CANHacker program with the QPCAN-USB FD device.
Certainly, in classic CAN mode only.
To do this, it is need to configure the settings in the Settings window of the CANHacker program.
CAN Device - PEAKUSB
CAN Baudrate - User Def. depending on the speed. The algorithm is below.
BTR0 - upper byte Baudrate Reg field
BTR1 - lower byte Baudrate Reg field
BRP = 10 * ( BTR0 & 0x3F ) + 9
tseg1 = ( BTR1 & 0xF )
tseg2 = ( BTR1 >> 4 ) & 0x07
SYSCLK = 80000000 (80 MHz)
BitRate = SYSCLK / ( 1 + BRP ) / ( 3 + tseg1 + tseg2 )
Examples.
1 MBit/s -> Baudrate Reg = 1
500 kBit/s -> Baudrate Reg = 14
250 kBit/s -> Baudrate Reg = 114
125 kBit/s -> Baudrate Reg = 314
100 kBit/s -> Baudrate Reg = 325
WTFPL