2019-07-08 06:45 PM
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
2019-07-09 09:44 AM
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
2019-07-09 07:08 PM
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
2019-07-10 03:20 AM
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