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

CLI not working on AUX1 and AUX2 #3691

Closed
1 task done
mha1 opened this issue Jun 18, 2023 · 7 comments
Closed
1 task done

CLI not working on AUX1 and AUX2 #3691

mha1 opened this issue Jun 18, 2023 · 7 comments
Labels
bug/regression ↩️ A new version of EdgeTX broke something

Comments

@mha1
Copy link
Contributor

mha1 commented Jun 18, 2023

Is there an existing issue for this problem?

  • I have searched the existing issues

What part of EdgeTX is the focus of this bug?

Transmitter firmware

Current Behavior

CLI not working on AUX1 and AUX2

Note:

  • CLI is working on USB-VCP
  • Telemetry Mirror is working on AUX1, AUX2

Expected Behavior

CLI working on AUX1 and AUX2

Steps To Reproduce

  • Connect serial monitor on either AUX1 or AUX2 GND, RX and TX (115200/8/N, make sure to send cr/lf on enter)
  • Select CLI in radio settings hw page on either AUX1 or Aux2
  • send help or anything followed by enter (cr/lf)
  • observe no CLI output

Version

Nightly (Please give date/commit below)

Transmitter

Radiomaster TX16S / TX16SMK2

Operating System (OS)

No response

OS Version

No response

Anything else?

nightly tx16s-c805940.bin

@mha1 mha1 added bug 🪲 Something isn't working triage Bug report awaiting review / sorting labels Jun 18, 2023
@mha1
Copy link
Contributor Author

mha1 commented Jun 18, 2023

CLI on AUX1 and AUX2 stopped working with commit 72913eda (PR #3055)

@pfeerick pfeerick added bug/regression ↩️ A new version of EdgeTX broke something and removed bug 🪲 Something isn't working labels Jun 19, 2023
@mha1
Copy link
Contributor Author

mha1 commented Jun 26, 2023

@raphaelcoeffic please have a look at this. I think the serial driver is missing a vital part for this to work.

As already stated this stopped working with #3055.

Changing line 235 of stm32_serial_driver.cpp from if (!st || st->sp) return nullptr; to if (!st) return nullptr; serial TX using cliSerialPutc() works. Why checking st->sp? Checking for already occupied UART? But then why is it occupied with e.g. AUX1/CLI being the only serial consumer.

But still no serial RX. The reason is line 124 in cli.cpp tries to register a callback using the driver function setReceiveCb if (drv->setReceiveCb) drv->setReceiveCb(ctx, cliReceiveData); but setReceiveCb is initialize in line 494 of stm32_serial_driver.cpp to a nullptr and is never set to anything else .setReceiveCb = nullptr, // TODO. Check out the comment. I think there is a vital piece of code missing.

I'd appreciate your guidance.

@raphaelcoeffic
Copy link
Member

I probably never tested this :-) Let me have a look to see what's wrong.

@raphaelcoeffic
Copy link
Member

raphaelcoeffic commented Jul 3, 2023

@mha1 the check in stm32_serial_driver.cpp is indeed aimed at preventing a serial port which is already used to be re-assigned without prior de-init.

Then, yes, as you found out, setReceiveCb is not implemented in the USART driver, only in USB CDC driver (see usbd_cdc.cpp). This probably needs to be done so we have something working properly.

The reason for this is that it is a bit tricky to do properly. We have 2 different working modes for these UARTs:

  • IRQ based: this is the simplest case, we receive bytes one by one and just need to pass them by using some proxy function that will adapt the API (basically etx_serial_callbacks_t::on_receive to void on_receive(uint8_t*, uint32_t)).
  • DMA based: this one is tricky. We probably need to make use of the idle IRQ and call on_receive(uint8_t*, uint32_t). Please note that the CLI code cannot poll the DMA buffer.

@pfeerick pfeerick removed the triage Bug report awaiting review / sorting label Jul 4, 2023
@mha1
Copy link
Contributor Author

mha1 commented Feb 26, 2024

@pfeerick @raphaelcoeffic Doesn't look like this will ever be solved. No big deal, CLI is working via USB-VCP. I'd like to close this with a request to eliminate CLI from the options list on AUX1/AUX2.

@pfeerick
Copy link
Member

Probably best to wait until Raphael resurfaces from work cave before we give up on this idea as it seems like he had thoughts on how to make this happen. But could certainly just kick CLI from the AUX1/2 lists for now though as that mode simply don't work.

@mha1
Copy link
Contributor Author

mha1 commented Oct 13, 2024

closed with #4679

@mha1 mha1 closed this as completed Oct 13, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug/regression ↩️ A new version of EdgeTX broke something
Projects
None yet
Development

No branches or pull requests

3 participants