I am building a motor controller board (Based on an STM32) driving a motor with a switching frequency of 70KHz. That same board (master) communicates with a sensor (Slave) on another board with short 20cm wires at a frequency of 1.5MHz.
Everything looks pretty clean (and working) when the motor idles.
However when the motor is controlled, the switching noise from the mosfets are triggering weird patterns on the MOSI and CLK lines.
On the oscilloscopes, while the switching noise is there all on 4 lines, only CLK/MOSI are reacting weirdly. CS and MISO both have pull up/down (respectively) which probably explains why they're not affected. During the actual data transmission (CLK/MOSI doing their thing) neither seems affected by the issue that much. As a matter of fact I have decoded a bunch of frames ignoring everything before a clean clock signal and everything is correct on MOSI - MISO is obviously junk due to the sensor seeing garbage in.
I have never encountered a scenario where pull up/down on CLK/MOSI were implemented but I did try to set a pull down on both CLK and MOSI with no visible improvement.
I am driving the NCS line through a GPIO (not using a hardware NSS) and it takes a few microseconds after NCS is brought low and CLK starts the clock. During that time, the erratic behavior of CLK and MOSI is causing the sensor to try to interpret an incoming command and obviously fails.
I have tried to focus on cleaning the switching noise as much as possible, I can continue to try to improve this but I suspect it will never perfect. So I am trying if instead I should try to focus more on understanding what's going on CLK/MOSI.
Has anyone ever seen anything like this?
edit: Hardware pull downs on CLK/MOSI helps getting those ripple down faster but it still doesn't prevent these jumps from triggering the sensor into trying to interpret the incoming data.
-1st screenshot is motor idle -2nd screenshot is motor active