-
-
Notifications
You must be signed in to change notification settings - Fork 356
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
fix: wrong TX polarity at CCPM pin for external PPM, DSM2 and LemonDSMP modules #3415
Conversation
Notes for PPM:
Notes for DSM2 and LemonDSMP: |
Ok, I think this needs to be approached differently - it looks like the TX16S is the odd one out, not the reference radio in this case, as while it is fine for PPM, DSM2 and LemonDSMP, the X9D+2019, TX12MK2 and NV14 are all wrong for DSM2 and LemonDSMP now, but PPM is now right. 🤷 |
Do I understand you correctly this PR fixes PPM for all radios but serial for DSM2 and LemonDSMP is now correct for TX16s but wrong for the rest? |
Yes, for the radios I tested, PPM (and PPM alone) was now correct. |
ok, and with or without this PR DSM2 and LemonDSP are wrong for X9D+2019, TX12MK2 and NV14. In other words: there was nothing wrong with DSM2 and LemonDSP for X9D+2019, TX12MK2 and NV14 in the first place? Only TX16s was wrong? Sorry for the dumb questions but I only have my TX16s available and am trying to establish a baseline of what was wrong on which radio. |
Sometimes a picture is worth a thousand words (and helps to make sure the monkey behind the keyboard didn't goof up 🤭 ) When I refer to 2.9.0, this is with the currently nightly. And the results are plain weird. As you can see, PPM is correct again, active neg. But for the EL18/NV14, this PR flipped DSM2 and DSMP. Although IIRC the EL18 has a programmable inverter, so that might need flipping also. But the X9D+2019 went wrong in main, and this PR didn't change that. |
…iver)module_timer_driver fixed problem of two back to back (hence invalid) ppm pulse trains at after init
dbffc62
to
2173810
Compare
@pfeerick Can you please repeat your tests, especially NV14 and X9D+. Trying a different approach, tested on my TX16s and - a round of applause please - thanks to @ParkerEde on X7access and X10epress. |
@ParkerEde got his hands on a X9D+ (not 2019) and tested the latest commit. Everything as it should be. |
@mha1 I'll try to have a look today. Some of the changes look fishy to me. I have the feeling this should be fixed differently, but I need to do a side-by-side comparison of the output signal (2.8 vs main). |
@raphaelcoeffic I think one thing might be the lack of a clear definition for the term "inverted". For FrSky inverted was the normal. and inverting a signal from FrSky's perspective yields inverted output for FrSky but normal to the outside world. I'd rather talk about the quiescent (idle) or active level at the pin. If we take quiescent level as the reference:
I think this is what makes the difference in the module/port API between using soft serial and UARTs. Soft serial outputs and expects idle high for polarity = normal. And I believe this is the other way around for the HW UART on external module bay due to FrSky's inverters. It'd be worth to harmonize this. I believe the only way to get this sorted is to have a clear definition of what normal and inverted means for the levels at the pins. |
@raphaelcoeffic Oh, and there is probably one change in radio/src/targets/common/arm/stm32/module_timer_driver.cpp you might ask why it's done. Turning on PPM by going from OFF to PPM in external modules produces two back to back frames which might confuse some modules. This is the very first that's output after selecting PPM. You can see the back to back frames: |
@mha1 the intent is the following:
As for what is what in terms of PPM output, the same parameters should lead to the same output in And yes, I'm wondering why we should de-init the DMA on each pulse sending. I do have some changes locally to init the DMA only once at setup, and then only enable/disable the stream. That allows for more flexibility for driver users that need different settings (WS2812 LEDs, for instance). |
This is what I mean. It's confusing what happens at the module bay pin. My humble opinion: the module/serial API is an abstraction layer that hides various types of hw designs. It should take care of business end-to-end. No thinking about hw design, no thinking about inverters. Think only in terms of what kind of protocol (logical and electrical) is sent/expected at the module bay's pins.
Correct. Status 2.9 vs 2.8: Levels for PPM are wrong way around, idle high serial output (as used by DSM2 and LemonDSMP) is wrong too for Horus and Taranis targets but are correct for NV14. I still believe this is a side effect of looking at MCU outputs rather than end-to-end. Therefore the port specific polarity settings in this PR. inverted for ETX_MOD_PORT_UART, normal for ETX_MOD_PORT_SOFT_INV to hopefully achieve the same result (waiting for NV14 test).
Maybe we should separate the two topics. The de-init I added can be removed again as it probably doesn't hurt having two back-to-back frames at startup of PPM. It just doesn't look right. So does the very first frame btw. It's an all low frame. I couldn't identify why this happens so far. |
converted to draft in favor of #3513 |
You're not getting off that easily... it might be two weeks later, but here are the results for the EL18 (basically the same as the NV14 for these tests)... which do seem to match 2.8.1. Now to try out #3513... |
Well, it seems I got off the hook, doesn't it? I checked #3513 a few days ago. It solved the problems on my TX16s but I found another issue with the transition from OFF to PPM. I also asked Raphael to check out NV14 and X9D to cover at least some significant hardware variants. He fixed the OFF to PPM On transition and with your feedback on #3513 TX16s, NV14 and X9D looked good. I'm glad Raphael fixed it himself because it's his code. That's the way it should be. PS - my counter to getting off easily:
|
next dev discussion hour on discord is on the 7th of Mai ,9am UTC / 11 am CEST |
replaced by #3513 |
Fixes #3413
Summary of changes:
Tested on TX16s ok.