Comments (4)
I used stm32f103vet6
It related to the board part number.
It related to the framework of STM32duino.
Check hehe.
I think SystemClock_Config is involved, but I don't know the solution.
from arduino-stm32-can.
Thanks for your reply.
I have solved the problem.
I found that V (C-D-E) used an internal clock, then I changed it to an external clock, and then I added a USB clock, and it worked fine
- framework-arduinoststm32/variants/STM32F1xx/F103Z(C-D-E)(H-T)/variant_generic.h
RCC_OscInitTypeDef RCC_OscInitStruct = {};
RCC_ClkInitTypeDef RCC_ClkInitStruct = {};
RCC_PeriphCLKInitTypeDef PeriphClkInit = {};
/** Initializes the RCC Oscillators according to the specified parameters
* in the RCC_OscInitTypeDef structure.
*/
/*
RCC_OscInitStruct.OscillatorType = RCC_OSCILLATORTYPE_HSI;
RCC_OscInitStruct.HSIState = RCC_HSI_ON;
RCC_OscInitStruct.HSICalibrationValue = RCC_HSICALIBRATION_DEFAULT;
RCC_OscInitStruct.PLL.PLLState = RCC_PLL_ON;
RCC_OscInitStruct.PLL.PLLSource = RCC_PLLSOURCE_HSI_DIV2;
RCC_OscInitStruct.PLL.PLLMUL = RCC_PLL_MUL16;
if (HAL_RCC_OscConfig(&RCC_OscInitStruct) != HAL_OK) {
Error_Handler();
}
*/
RCC_OscInitStruct.OscillatorType = RCC_OSCILLATORTYPE_HSE;
RCC_OscInitStruct.HSEState = RCC_HSE_ON;
RCC_OscInitStruct.HSEPredivValue = RCC_HSE_PREDIV_DIV1;
RCC_OscInitStruct.HSIState = RCC_HSI_ON;
RCC_OscInitStruct.PLL.PLLState = RCC_PLL_ON;
RCC_OscInitStruct.PLL.PLLSource = RCC_PLLSOURCE_HSE;
RCC_OscInitStruct.PLL.PLLMUL = RCC_PLL_MUL9;
if (HAL_RCC_OscConfig(&RCC_OscInitStruct) != HAL_OK) {
Error_Handler();
}
/** Initializes the CPU, AHB and APB buses clocks
*/
RCC_ClkInitStruct.ClockType = RCC_CLOCKTYPE_HCLK | RCC_CLOCKTYPE_SYSCLK
| RCC_CLOCKTYPE_PCLK1 | RCC_CLOCKTYPE_PCLK2;
RCC_ClkInitStruct.SYSCLKSource = RCC_SYSCLKSOURCE_PLLCLK;
RCC_ClkInitStruct.AHBCLKDivider = RCC_SYSCLK_DIV1;
RCC_ClkInitStruct.APB1CLKDivider = RCC_HCLK_DIV2;
RCC_ClkInitStruct.APB2CLKDivider = RCC_HCLK_DIV1;
if (HAL_RCC_ClockConfig(&RCC_ClkInitStruct, FLASH_LATENCY_2) != HAL_OK) {
Error_Handler();
}
PeriphClkInit.PeriphClockSelection = RCC_PERIPHCLK_ADC | RCC_PERIPHCLK_USB;
PeriphClkInit.AdcClockSelection = RCC_ADCPCLK2_DIV6;
PeriphClkInit.UsbClockSelection = RCC_USBCLKSOURCE_PLL_DIV1_5;
if (HAL_RCCEx_PeriphCLKConfig(&PeriphClkInit) != HAL_OK) {
Error_Handler();
}
from arduino-stm32-can.
wonderful!
from arduino-stm32-can.
I found that:
Arduino core support for STM32 based boards uses different clock frequencies depending on the Board Part Number.
BlackPill & BluePill use 72Mhz.
Generic board like stm32f103vet6 use 64Mhz.
So old version doesn't work properly on the Generic board like stm32f103vet6.
Latest support both of 72Mhz and 64Mhz.
from arduino-stm32-can.
Related Issues (20)
- Send Fail HOT 16
- Canard HOT 1
- Possible to read but can't send data. HOT 28
- Raspberry Pi wiring example issue HOT 1
- CAN messages dropped, sometime receiving message up to six times HOT 9
- STM32F103C8T6 hangs on CANInit(CAN_1000KBPS, 2) HOT 3
- STM32F103 gets stuck inside while (!(CAN1->MSR & 0x1UL)); HOT 26
- Send Fail on STM32F407VE HOT 15
- how is Serial and CAN being used simultaneously in STM32F103? HOT 3
- STM32F413ZH NUCLEO-F413ZH HOT 13
- CAN on STM32G4 series HOT 1
- Discuss: other ways to clear mailbox? HOT 1
- Mistake in Line 277 HOT 5
- STM32F042F6P6TR HOT 1
- feature request: support multiple transmit mailboxes HOT 12
- BARTH STG-850 Support HOT 5
- Unable to communicate STM32f103 vs ESP32 via CAN BUS HOT 2
- Sending data issue HOT 9
- dlc bigger than 8 HOT 7
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from arduino-stm32-can.