cancel
Showing results for 
Search instead for 
Did you mean: 

GPIO interrups every system tick

Alex Chen
Associate II

Hi all,

I am using F303re to control an e-bike motor. I use GPIO PA6 connected to a speed sensor located on the wheel of e-bike.

Every time the wheel takes a loop, an interrupt is sent from the speed sensor.

Below is GPIO setting:

 GPIO_InitStruct.Pin = Speed_Pin;

 GPIO_InitStruct.Mode = GPIO_MODE_IT_FALLING;

 GPIO_InitStruct.Pull = GPIO_NOPULL;

 HAL_GPIO_Init(Speed_GPIO_Port, &GPIO_InitStruct);

My problem is that sometimes when e-bike motor is running, I get interrupts every system tick (1 ms).

I tried to connect this PA6 GPIO pin to a 3.3V VDD, which I expect no interrupts would incoming, but surprisingly there are still interrupts.

Does anyone meet this problem before? Or some clues?

Thank you.

Alex

3 REPLIES 3
cedric H
ST Employee

Hello Alex,

Do you use the MCSDK provided by ST in order to do the control motor ?

If so, could you attach the IOC file generated by your project, and the log file located in your project folder.

Thanks a lot

Cedric

Alex Chen
Associate II

Hi Cedric,

Thanks for the reply.

Yes, I use MCSDK provided by ST to do the control motor.

Since I am outside, I will attach the IOC file and I don' t know where the log file is located.

Can you give me the file path?

BTW, the output signal from speed sensor is 5V, and we found that PA6 pin is TTA (3.3V tolerant).

Is it possible that the higher voltage causes interrupts trigger misjudgment ?

Thank you.

Alex

Alex,

If your sensor output voltage is 5V I would suggest you to add a 5V - 3.3 adaptation circuit, Does your power board comes from ST ?

Do you know the sensor output value when it is not active ?

Is the ground of your sensor connected to the ground of the MCU ?

Instead of connecting PA6 to VDD, try to connect it to GND, and add an internal PULL_DOWN, it should not trig EXT6.

(You can also keep the connection to VDD, and in this case configure PA6 GPIO to use the internal PULL-UP).

Regards

Cedric