Because I am engaged in automotive CAN bus and multimedia decoding boxes, I often need to decode some simple CAN data. The hardware IO required is not much, just CAN+UART, so in order to save costs, I have also spent a lot of thought recently.
Until recently, I discovered STM32F042, which is said to be the smallest package chip with CAN.
STM32F042----Cortex-M0 core. The chip was launched in early 2014 and is known as the cheapest MCU with CAN bus....
After checking the manual carefully, I found that it is suitable for my project and the price is cheap, between RMB 4-6, and the smallest package is TSSOP20. It is tailor-made for small automotive products.
Without further ado, let's get started and build the minimum system first. The CAN transceiver TJA1050+STM32F042+7533 is the simplest. No crystal oscillator is needed for the time being. Although a crystal oscillator is still needed when the CAN baud rate is relatively high, a crystal oscillator costs a lot of RMB.
The most troublesome thing came next, because I was used to using IAR for development, and the program source codes I had accumulated were all from UCOSII, and the open source codes on the Internet were all from KEIL MDK. This was embarrassing...
But there is no other way. In order to save costs, I have to spend more time.
Two weeks later, everything was basically adjusted and the code architecture was migrated OK. Now we can finally migrate all the 103 codes to F042.
There are a few things to note:
1. Library function differences: F042 has modified many library functions, so you need to pay attention to the differences;
2. The CAN of F042 is different from that of 103, and you need to refer to the register definition. For high-speed baud rates such as 500K and 800K, an external crystal oscillator is required;
3. USART1 cannot be used because it is multiplexed with USART1/CAN/USB and is occupied by CAN;
4. The configuration file of F042 is not standardized. Many register definitions can only be found in F072, and the configuration file of F072 cannot be fully used;
5. The *it.c file of F042 is not standardized. In fact, the STM32F0 series is the same. The library function version is low, and the interrupt function file is not standardized, resulting in confusion in many function definitions;
6. Clock safety CSS is not mentioned at all. Although it can be found in various materials, almost no one uses it, and no one pays attention to the importance of CSS.
7. The power consumption of F042 is much smaller. Under the same clock 8MHZ, the current of F042 is only 4mA, while 103 reaches more than 9mA;
8. USART1 of F042 is an enhanced serial port that supports LIN master-slave mode, while UART2 is a common serial port that cannot be used in LIN master mode;
9. The nominal FLASH capacity of P042F4 is 16K, but the actual capacity is 32K. The F042F6 is really only 32K. I don't understand why.
10. It does a good job in low power consumption and is much more convenient than the F1 series.
Finally, I hope that F042 will be like 103, with cheaper price and better quality.
-------------------------------------------------------------
20180330 New questions:
Because this chip is used to make both CAN interface and LIN interface, I found that I could not completely transplant the LIN function library of the F1XX series. Because the function library of the F0XX series lacks many LIN-related functions compared to the F1XX, for example, there is a function Send_Break() which is very necessary for LIN communication, but I could not find the function definition at all. For this reason, I spent a lot of time studying how to implement the SendBreak function, but I still couldn't find it after more than a month. Finally, I spent money on Taobao to find a great person to help me solve it.
Some problems seem simple, but they are not the case when you actually make the product.
As the result of honest labor, every line of code is the result of many people's hard work and even painful lessons. Some ancestral codes may look messy but they are real iron rice bowls. The personal value of each programmer depends on these codes. Therefore, please respect the labor of others and cherish your own labor!
Previous article:Using STM32F103 for CAN transceiver communication
Next article:STM32 CAN bus experimental experience
Recommended ReadingLatest update time:2024-11-23 18:40
- Popular Resources
- Popular amplifiers
- The STM32 MCU drives the BMP280 absolute pressure sensor program and has been debugged
- DigiKey \"Smart Manufacturing, Non-stop Happiness\" Creative Competition - Small Weather Station - STM32F103 Sensor Driver Code
- LwIP application development practical guide: based on STM32
- FreeRTOS kernel implementation and application development practical guide: based on STM32
- Naxin Micro and Xinxian jointly launched the NS800RT series of real-time control MCUs
- How to learn embedded systems based on ARM platform
- Summary of jffs2_scan_eraseblock issues
- Application of SPCOMM Control in Serial Communication of Delphi7.0
- Using TComm component to realize serial communication in Delphi environment
- Bar chart code for embedded development practices
- Embedded Development Learning (10)
- Embedded Development Learning (8)
- Embedded Development Learning (6)
Professor at Beihang University, dedicated to promoting microcontrollers and embedded systems for over 20 years.
- Intel promotes AI with multi-dimensional efforts in technology, application, and ecology
- ChinaJoy Qualcomm Snapdragon Theme Pavilion takes you to experience the new changes in digital entertainment in the 5G era
- Infineon's latest generation IGBT technology platform enables precise control of speed and position
- Two test methods for LED lighting life
- Don't Let Lightning Induced Surges Scare You
- Application of brushless motor controller ML4425/4426
- Easy identification of LED power supply quality
- World's first integrated photovoltaic solar system completed in Israel
- Sliding window mean filter for avr microcontroller AD conversion
- What does call mean in the detailed explanation of ABB robot programming instructions?
- STMicroelectronics discloses its 2027-2028 financial model and path to achieve its 2030 goals
- 2024 China Automotive Charging and Battery Swapping Ecosystem Conference held in Taiyuan
- State-owned enterprises team up to invest in solid-state battery giant
- The evolution of electronic and electrical architecture is accelerating
- The first! National Automotive Chip Quality Inspection Center established
- BYD releases self-developed automotive chip using 4nm process, with a running score of up to 1.15 million
- GEODNET launches GEO-PULSE, a car GPS navigation device
- Should Chinese car companies develop their own high-computing chips?
- Infineon and Siemens combine embedded automotive software platform with microcontrollers to provide the necessary functions for next-generation SDVs
- Continental launches invisible biometric sensor display to monitor passengers' vital signs
- EETALK: Do radio frequency beauty devices really work? A complete review of alternative radio frequency applications!
- Xunwei-IMX6Q development board Android application test-AndroidStudio-recorder test
- Beware of ActiveX plug-ins that can become accomplices of viruses when surfing the Internet safely
- [GD32L233C] + 2. Sort out some configuration issues
- How to Make DSP Digital Oscillator Generate Phase-Shifted Sine Wave
- Unboxing Review (Part 3) Preliminary Understanding
- (Awards have been awarded) "Say hello" and get a gift: Comparing stm32cubemx, let's get to know the domestically produced Fudan Micro Cube MFANG
- STM32F10 Chinese reference material
- Showing my products + my development board
- The relationship between instruction set architecture, arm core, SoC, processor, CPU, GPU, etc.