5181 views|12 replies

6818

Posts

11

Resources
The OP
 

[Fudan Micro FM33LG0 Series Development Board Review] CAN Test 2 [Copy link]

 
 

Continue to test CAN. Yesterday I thought that the TJA1050 was broken. This morning when I was reading the STM32CAN book, I saw the schematic diagram. TJA1050 needs 5V power supply. I suddenly remembered that our development board is powered by 3.3V, so I powered it on to test it. Sure enough, the VCC drawn on the board is 3.3V. I opened the schematic diagram and saw that there is a place where the jumper needs to select 5V and 3.3V. The screenshot is as follows:

Find J28 and change the jumper to 5V. Continue power-on test.

But the communication still cannot be connected. The code burned is the official routine:

I specifically picked up the CAN configuration process of STM32 and checked the official program:

void can_init(void)

{

FL_GPIO_InitTypeDef GPIO_InitStruct = {0};

FL_CAN_InitTypeDef CAN_InitStructure = {0};

FL_CAN_FilterInitTypeDef CAN_FilterInitStructure = {0};

/*-----------------------------------GPIO initialization---------------------------------------*/

GPIO_InitStruct.pin = FL_GPIO_PIN_9;

GPIO_InitStruct.mode = FL_GPIO_MODE_DIGITAL;

GPIO_InitStruct.pull = FL_ENABLE;

GPIO_InitStruct.outputType = FL_GPIO_OUTPUT_PUSHPULL;

GPIO_InitStruct.remapPin = FL_DISABLE;

FL_GPIO_Init(GPIOE, &GPIO_InitStruct);

GPIO_InitStruct.pin = FL_GPIO_PIN_10;

GPIO_InitStruct.mode = FL_GPIO_MODE_DIGITAL;

GPIO_InitStruct.pull = FL_ENABLE;

GPIO_InitStruct.outputType = FL_GPIO_OUTPUT_PUSHPULL;

GPIO_InitStruct.remapPin = FL_DISABLE;

FL_GPIO_Init(GPIOD, &GPIO_InitStruct);

/*----------------------------CAN structure initialization--------------------------------------*/

//Baud rate setting = CAN_CLK/(BRP+1)/(TS1_Tq+TS2_Tq+1); 8M/(7+1)/(5+4+1)=100K

CAN_InitStructure.TS1 = FL_CAN_TS1_5Tq;

CAN_InitStructure.TS2 = FL_CAN_TS2_4Tq; //Bit timing setting

CAN_InitStructure.SJW = FL_CAN_SJW_1Tq;

CAN_InitStructure.BRP = 7; //Baud rate pre-scaling

CAN_InitStructure.mode = FL_CAN_MODE_NORMAL; //Working mode setting

CAN_InitStructure.clockSource = FL_CMU_CAN_CLK_SOURCE_XTHF; //Clock source setting

FL_CAN_Init(CAN, &CAN_InitStructure);

/*----------------------------Receive filter structure initialization--------------------------------------*/

CAN_FilterInitStructure.filterIdStandard = 0X6AD; //Standard ID

CAN_FilterInitStructure.filterIdSRR = 0;

CAN_FilterInitStructure.filterIdIDE = 0;

CAN_FilterInitStructure.filterIdRTR = 0;

CAN_FilterInitStructure.filterMaskIdHigh = 0X7FF;

CAN_FilterInitStructure.filterMaskIdSRR = 0x01;

CAN_FilterInitStructure.filterMaskIdIDE = 0x01; //Filter mask, 1: This bit participates in filter comparison, 0: Not involved

CAN_FilterInitStructure.filterMaskIdRTR = 0x01;

CAN_FilterInitStructure.filterEn = FL_ENABLE;

FL_CAN_FilterInit(CAN, &CAN_FilterInitStructure, FL_CAN_FILTER1);

FL_CAN_ClearFlag_CRXOK(CAN);

FL_CAN_EnableIT_RXOK(CAN); //Receive interrupt enable

NVIC_DisableIRQ(CAN_IRQn);

NVIC_SetPriority(CAN_IRQn, 2); //Interrupt priority configuration

NVIC_EnableIRQ(CAN_IRQn);

}

//Baud rate setting = CAN_CLK/(BRP+1)/(TS1_Tq+TS2_Tq+1); 8M/(7+1)/(5+4+1)=100K

This sentence indicates that the communication rate is 100K. I used a 100K CAN analyzer, but I didn't receive any information.

So I suspected that my TJA1050 was broken. I took it out with a logic analyzer to test whether the signal output was

After repeatedly adjusting the CAN analysis baud rate, it can only display such analysis data when it is adjusted to around 160K, but it is still wrong with the test data sent by the program.

Let's look at the baud rate calculation formula in the example:

/*----------------------------CAN structure initialization--------------------------------------*/

//Baud rate setting = CAN_CLK/(BRP+1)/(TS1_Tq+TS2_Tq+1); 8M/(7+1)/(5+4+1)=100K

CAN_InitStructure.TS1 = FL_CAN_TS1_5Tq;

CAN_InitStructure.TS2 = FL_CAN_TS2_4Tq; //Bit timing setting

CAN_InitStructure.SJW = FL_CAN_SJW_1Tq;

CAN_InitStructure.BRP = 7; //Baud rate pre-scaling

The baud rate calculation formula of STM32 is:

CAN_InitStructure.CAN_Mode = CAN_Mode_Normal;

CAN_InitStructure.CAN_SJW = CAN_SJW_1tq;

CAN_InitStructure.CAN_BS1 = CAN_BS1_11tq;

CAN_InitStructure.CAN_BS2 = CAN_BS2_6tq; //36/(1+11+6)/4 == 500K

CAN_InitStructure.CAN_Prescaler = 4;

Browse the user manual

FL STM32

#define FL_CAN_TS1_1Tq 0 #define CAN_BS1_1tq ((uint8_t)0x00)

#define FL_CAN_TS1_2Tq 1 #define CAN_BS1_2tq ((uint8_t)0x01)

#define FL_CAN_TS2_1Tq 0 #define CAN_BS2_1tq ((uint8_t)0x00)

#define FL_CAN_TS2_2Tq 1 #define CAN_BS2_2tq ((uint8_t)0x01)

#define FL_CAN_SJW_1Tq 0 CAN_SJW_1tq ((uint8_t)0x00)

#define FL_CAN_SJW_2Tq 1 CAN_SJW_2tq ((uint8_t)0x01)

Logically speaking, his calculation formula should be: their register descriptions and addresses are consistent for the two years, so why is the baud rate wrong with the same configuration?

Please ask the official technicians to help answer this question.

I went to the official website and looked around, but there was no posting about this.

It seems that it is still difficult to get started with this niche board. The official needs to strengthen the supporting information.

This post is from Domestic Chip Exchange

Latest reply

TTL to CAN? Why not buy USB? I see the cheap one is 24 yuan. It used to cost hundreds or thousands of yuan.   Details Published on 2024-4-19 16:30
 
 

9702

Posts

24

Resources
2
 

The picture is not displayed

This post is from Domestic Chip Exchange

Comments

I see it's normal, is it a system problem?  Details Published on 2021-12-8 19:05
 
 
 

6818

Posts

11

Resources
3
 
littleshrimp posted on 2021-12-8 15:26 The picture cannot be displayed

I see it's normal, is it a system problem?

This post is from Domestic Chip Exchange

Comments

I just used my mobile phone, this time it worked fine using my computer.  Details Published on 2021-12-8 19:32
 
 
 

6818

Posts

11

Resources
4
 
lugl4313820 posted on 2021-12-8 19:05 I see it's normal here, is it a system problem!

Can I add you as a friend to help me take a look?

This post is from Domestic Chip Exchange
 
 
 

9702

Posts

24

Resources
5
 
lugl4313820 posted on 2021-12-8 19:05 I see it's normal here, is it a system problem!

I just used my mobile phone, this time it worked fine using my computer.

This post is from Domestic Chip Exchange
Personal signature虾扯蛋,蛋扯虾,虾扯蛋扯虾
 
 
 

7422

Posts

2

Resources
6
 

It seems that there are still many pitfalls if you want to completely replace STM32.

This post is from Domestic Chip Exchange

Comments

Domestic chips are like this. They are advertised as being completely replaceable, but in reality, there are still big differences in use. I guess it is also due to intellectual property issues.  Details Published on 2021-12-17 08:53
Personal signature

默认摸鱼,再摸鱼。2022、9、28

 
 
 

1

Posts

0

Resources
7
 

Is your screenshot the waveform of CAN TX or the waveform on the CAN bus?

There are two possibilities

One is that the system clock is incorrect. The routine uses the default system clock RCHF 8MHZ, which is usually calibrated at the factory.

Some chips on the development board may be tested manually, so there is a possibility of missing some chips, but the probability is relatively low.

You can use GPIO FOUT in the application package to output RCHF 8M to see if the system clock is accurate.

Another possibility is that the CAN transceiver is not connected properly, which may also cause similar problems.

This post is from Domestic Chip Exchange

Comments

[attachimg]578772[/attachimg]This is the picture of TM I measured using the GPIO FOUT example. Today I bought a new TJA1050 and it arrived, but I can't test it either. Please help me!  Details Published on 2021-12-16 20:14
[attachimg]578772[/attachimg]This is the picture of TM I measured using the GPIO FOUT example. Today I bought a new TJA1050 and it arrived, but I can't test it either. Please help me!  Details Published on 2021-12-16 19:58
 
 
 

6818

Posts

11

Resources
8
 
This post was last edited by lugl4313820 on 2021-12-16 20:02
alskdj published on 2021-12-10 10:17 Is your screenshot the waveform of can TX or the waveform on the can bus? There are two possibilities. One is that the system clock is wrong, and the routine uses the default...

This is the picture of TM I measured using the GPIO FOUT example. I looked at the example program and found that FOUT is FL_GPIO_SetFOUT0(GPIO, FL_GPIO_FOUT0_SELECT_AHBCLK_DIV64), which should be 64-divided 8M/64, which should be 125KHz. Today I bought a new TJA1050 and it has not worked for me. I would like to ask an expert for help!

This post is from Domestic Chip Exchange
 
 
 

6818

Posts

11

Resources
9
 
This post was last edited by lugl4313820 on 2021-12-16 20:18
alskdj published on 2021-12-10 10:17 Is your screenshot the waveform of can TX or the waveform on the can bus? There are two possibilities. One is that the system clock is wrong, and the routine uses the default...

After flashing the official CAN extended data frame interrupt reception, the oscilloscope measured the TX frequency to be 2.38KHz

In order to test this CAN, I worked hard and bought a CAN transceiver worth dozens of dollars. I hope Fudan Micro can give me some good suggestions.

This post is from Domestic Chip Exchange

Comments

TTL to CAN? Why not buy USB? I see the cheap one is 24 yuan. It used to cost hundreds or thousands of yuan.  Details Published on 2024-4-19 16:30
 
 
 

1412

Posts

3

Resources
10
 
freebsder posted on 2021-12-9 17:54 It seems that there are still many pitfalls if you want to completely replace STM32.

Domestic chips are like this. They are advertised as being completely replaceable, but in reality, there are still big differences in use. I guess it is also due to intellectual property issues.

This post is from Domestic Chip Exchange
Personal signature

没有什么不可以,我就是我,不一样的烟火! 

 
 
 

29

Posts

3

Resources
11
 
lugl4313820 posted on 2021-12-16 20:14 alskdj posted on 2021-12-10 10:17 Is your screenshot the waveform of can TX or the waveform on the can bus? There are two possibilities. One is the system...

You can add my QQ and I will help you check 974170020

This post is from Domestic Chip Exchange
 
 
 

3

Posts

0

Resources
12
 
doudou52098 posted on 2021-12-30 15:07 You can add me on QQ and I will help you check 974170020

Do you have a mobile phone or WeChat?

This post is from Domestic Chip Exchange
 
 
 

22

Posts

0

Resources
13
 
lugl4313820 posted on 2021-12-16 20:14 After brushing the official CAN extended data frame interrupt reception, the oscilloscope measured the TX frequency to be 2.38KHz. In order to measure this CAN, I also...

TTL to CAN? Why not buy USB? I see the cheap one is 24 yuan. It used to cost hundreds or thousands of yuan.

This post is from Domestic Chip Exchange
 
 
 

Just looking around
Find a datasheet?

EEWorld Datasheet Technical Support

EEWorld
subscription
account

EEWorld
service
account

Automotive
development
circle

Copyright © 2005-2024 EEWORLD.com.cn, Inc. All rights reserved 京B2-20211791 京ICP备10001474号-1 电信业务审批[2006]字第258号函 京公网安备 11010802033920号
快速回复 返回顶部 Return list