Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to check if firmware loaded is working? Is there a simple way to debug? #63

Open
randuwiino opened this issue May 18, 2024 · 12 comments

Comments

@randuwiino
Copy link

Hi Goebish,

I tried to replicate using pro mini 3.3v + NRF24L01+PA+LNA (10uf capacitor 3.3&GND), i've used a 3.3v regulator to power both and it works fine, i have tested using a test transmit receive code and it works fine, now I changed the TAER to AETR in the code and uploaded it, i put a 10K resistor for my ppm, i'm using a jumper t-lite with the external adapter for external module, i soldered the ppm, power and ground, so the module is powered by the transmitter, but now i am trying to bind to a wltoys and it does not bind, everything loos fine, power and also booting, the promini led blinks at power up.

Is there a way i can know if the code is working, any simple debugging i can add to the code? or any sign from the LED?

Thanks very much.

@goebish
Copy link
Owner

goebish commented May 18, 2024

LED blinking means the PPM input is not detected.

That's probably because PPM output (from transmitter) shouldn't be directly connected to PPM input (arduino).
You have to shift the level to 3.3V using a transistor or mosfet and a couple of resistor.
Except if you're sure the PPM output of the transmitter already outputs a 3.3V signal, but I doubt it.

@goebish
Copy link
Owner

goebish commented May 18, 2024

Here is the circuit I use, with a BSS138 mosfet, but you can use any small signal N-channel mosfet or NPN transistor as long as it is wired properly. This circuit does invert the signal as well but the code doesn't care of the signal polarity.
Note PPM_IN and PPM_OUT are labelled as seen from the module's circuit, obviously it should be connected to the transmitter's PPM output.
Km99vxX

@randuwiino
Copy link
Author

oh i see, that make sense, i have a logic level converter, i will try, are there any signal in LED that i need to watch for to see if its working or not? also i noticed the board does not turned on when the throttle stick is not at the down position, so in my case which is the WLTOYS, the instructions says only elevator up, so it means throttle down + elevator up? is that correct?

@goebish
Copy link
Owner

goebish commented May 18, 2024

A logic level converter might work but is not ideal because you'll need a voltage source of the same voltage as the PPM output (to be measured with a scope ...). Better use a single mosfet or transistor so only a 3.3V source is required, which you already have. (hint: you might get them from your logic level converter's board 😉)
If the instructions says only elevator up, the other stick needs to be centered on both axis, not down, this selects the protocol, then the LED will stop blinking but the protocol will only start when throttle is down (that's for safety).

@goebish
Copy link
Owner

goebish commented May 18, 2024

And if you want to debug, start by checking if you're stuck here, that's probably the case:

while(!ppm_ok) {} // wait

Just add some debug output code into the { }, as long as the code is here it means PPM input is not detected.

@goebish
Copy link
Owner

goebish commented May 18, 2024

don't use a simple Serial.println, that would mess up the PPM interrupt, use something like that into the { }:

static unsigned long debugStamp = 0;
if (millis() >= debugStamp) {
    Serial.println("Waiting for PPM input...");
    debugStamp += 1000;
}

edit: if not already done, init the UART in setup(), after frskyInit(); :
Serial.begin(115200);

@randuwiino
Copy link
Author

I don't have a mosfet, my hands are too shaky to unsolder too small components, but i do have an NPN transistor, can you show me a diagram if i use NPN transistor? Thanks very much for the debug code, that would help a lot.

@goebish
Copy link
Owner

goebish commented May 18, 2024

(edited, messed up the wiring...)
Basically it's the same as with a MOSFET, with a NPN transistor you would:

  • connect its Emitter to ground (bottom pin of the MOSFET in the diagram)
  • connect its Base to the PPM output of the transmitter with a 10k resistor in serial (left side pin in the diagram)
  • connect its Collector to the arduino PPM interrupt pin and to +3.3V with a 10k resistor in serial (top pin in the diagram)
  • make sure transmitter and arduino ground are connected together

Use google to know which pins C, B and E are with your transistor's model.

@goebish
Copy link
Owner

goebish commented May 18, 2024

Sorry, I edited my previous message, you might have connected your transistor in reverse...

@randuwiino
Copy link
Author

i added the transistor and resistors as per the diagram, now when i power up the transmitter, led blinks once. is that the correct behavior? although i still could not bind.

@goebish
Copy link
Owner

goebish commented May 18, 2024

First try to add some debug code to check if PPM input is detected.
The LED only turns on once it's been detected.

@randuwiino
Copy link
Author

randuwiino commented May 18, 2024

I added a debug code, i get the Serial.println from the setup, but not the LED HIGH inside the Loop.
Im not sure if my transmitter pinout is correct, from right to left (pin,gnd,positive,pin,ppm,pin,pin,pin).

2024-05-19-080321
Screenshot from 2024-05-19 07-41-11
Screenshot from 2024-05-19 07-41-58

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants