STM32F042 replaces STM32F103

Publisher:平凡梦想Latest update time:2018-09-02 Source: eefocusKeywords:STM32F042  STM32F103 Reading articles on mobile phones Scan QR code
Read articles on your mobile phone anytime, anywhere

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!


Keywords:STM32F042  STM32F103 Reference address:STM32F042 replaces STM32F103

Previous article:Using STM32F103 for CAN transceiver communication
Next article:STM32 CAN bus experimental experience

Recommended ReadingLatest update time:2024-11-23 18:40

STM32F103 Study Notes (VI) Independent Watchdog and Window Watchdog
First, to learn about the two types of dogs, you should see the difference between them: (1) The independent watchdog is driven by an internal dedicated 40Khz low-speed clock, while the window watchdog uses the PCLK1 clock. The clock needs to be enabled first, while the independent watchdog does not need to be enabled
[Microcontroller]
stm32f103 RTC periodic standby wake-up (I)
I have been working on a low-power device for several days, but the program has been stuck in one place (see the picture below). Today I finally found out where the problem lies. I will summarize the problems of standby wakeup (only for the problems I encountered, the other parts are available on the Internet, based o
[Microcontroller]
stm32f103 RTC periodic standby wake-up (I)
STM32F103V---Firmware library use---USART1
 /******************** USART Application************************ stm32 library file application --- USART1 application Chip model: STM32F103V Pin: TXD1: PA9-US1-TX RXD1: PA10-US1-RX Date of writing: March 24, 2012 Author: ClimberWin Effect: Serial port 1 outputs data, cyclically accumulates Baud rate: 9600,n,8,
[Microcontroller]
Porting STemWin to FreeRTOS on STM32F103RCT6
1. Version information STM32 firmware library V3.5.0 FreeRTOS V8.2.3 STEMWin 5.26 Keil 4 2. Transplantation steps Porting FreeRTOS to STM32F103RCT6, as mentioned in the previous blog, is a reference for this class; Add the LCD screen driver code. In this experiment, the MINI board of Zhengdian Atom uses the IL
[Microcontroller]
Porting STemWin to FreeRTOS on STM32F103RCT6
Latest Microcontroller Articles
Change More Related Popular Components

EEWorld
subscription
account

EEWorld
service
account

Automotive
development
circle

About Us Customer Service Contact Information Datasheet Sitemap LatestNews


Room 1530, 15th Floor, Building B, No.18 Zhongguancun Street, Haidian District, Beijing, Postal Code: 100190 China Telephone: 008610 8235 0740

Copyright © 2005-2024 EEWORLD.com.cn, Inc. All rights reserved 京ICP证060456号 京ICP备10001474号-1 电信业务审批[2006]字第258号函 京公网安备 11010802033920号