Upcoming maintenance
Dear Customers and Partners.
This website will be undergoing scheduled maintenance on June 14, 2023. Please be aware there may be disruption to the developer portal website and associated services during the scheduled maintenance period.
This upgrade is essential to ensure the continued performance, reliability, and security of Developer World.
We apologize for any inconvenience.
Custom extension board PWM0 problem
-
Hi all,
Perhaps someone recognizes this problem or has any idea what the problem could be.
I've made a PCB design with a B2B connector installed. I needed PWM for a project without the large extension board scale. So I've made my own extension board.
I've generated a 1500ms pulse on all PWM pins. The output of these PWM were measured with Saleae Logic Analyzer. In the image underneath the pulses for PWM0, PWM1, PWM2 and PWM3. As you might have noticed the pulse PWM0 is not the same as the other PWM pulses.
After zooming in on the pulse
The length of pulse PWM0 is the right length (1500ms) but the pulse exist of little pulses (second image). This causes problem for my use case.
First thought was a bad solder, but if this would be the case the little pulses interval would not be so consistent.
Second thought was missing a component on my PCB like a capacitor, but in that case all pulses would have shown the same problem, not only one.
Third thought was that perhaps PWM0 was reserved by the MCU, but based on the documentation, shown in the image underneath, this isn't the case as well.
So I have none logical explanation on why PWM0 is generating a PWM signal with little pulses.
Has some one perhaps has any idea on what could be the problem?
-
Hi, Xander!
Could you maybe provide the code you used to generate the PWM waves? Then I can see if I can reproduce the problem on my side.
-
#ifdef SUBCORE #error "Core selection is wrong!!" #endif #include <Servo.h> #define PWM0 PIN_D06 #define PWM1 PIN_D05 #define PWM2 PIN_D09 #define PWM3 PIN_D03 Servo motor_1; Servo motor_2; Servo motor_3; Servo motor_4; void setup() { motor_1.attach(PWM0); motor_2.attach(PWM1); motor_3.attach(PWM2); motor_4.attach(PWM3); } void loop() { motor_1.writeMicroseconds(1500); motor_2.writeMicroseconds(1500); motor_3.writeMicroseconds(1500); motor_4.writeMicroseconds(1500); }
Hope you could help me and reproduce this problem. This code is running on a the Sony spresense main board connected with a board 2 board to a custom designed extension board.
-
This post is deleted! -
After long time debugging I've found out that my level shifter SMD chip was faulty. After replacement the problem is solved . Thanks for the help
-
Hi, @Jamu
Thank you for sharing your solution! It might help someone else in the future.