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

USE_MSP_UART does not activate MSP on UART1 #13642

Closed
Scavanger opened this issue May 16, 2024 · 6 comments · Fixed by betaflight/betaflight.com#422
Closed

USE_MSP_UART does not activate MSP on UART1 #13642

Scavanger opened this issue May 16, 2024 · 6 comments · Fixed by betaflight/betaflight.com#422
Labels

Comments

@Scavanger
Copy link
Contributor

Describe the bug

If compiled with the extra flag "USE_MSP_UART", MSP is not activated on UART1.

/src/main/io/serial.c, Line 211

#if defined(USE_MSP_UART)
    serialPortConfig_t * uart1Config = serialFindPortConfigurationMutable(USE_MSP_UART);
    if (uart1Config) {
        uart1Config->functionMask = FUNCTION_MSP;
    }
#endif

The Argumet for serialFindPortConfigurationMutable should be SERIAL_PORT_USART1, if i'am right?

To Reproduce

Compile with EXTRA_FLAG=-DUSE_MSP_UART

Expected behavior

MSP is activted on UART1

Support ID

Doesn't matter

Flight controller

ALL

Other components

No response

How are the different components wired up (including port information)

No response

Add any other context about the problem that you think might be relevant here

No response

@Scavanger Scavanger added the Template: Bug Set by auto_close_issue. label May 16, 2024
@haslinghuis haslinghuis added Question and removed Template: Bug Set by auto_close_issue. labels May 16, 2024
@haslinghuis
Copy link
Member

@Scavanger

MSP_UART define is for configuration purposes

When passing a value for a macro through EXTRA_FLAGS we need to use single quotes, e.g. to set USART1 we could use

-D'MSP_UART=SERIAL_PORT_USART1'

When using the configurator to start a cloud build the value can be placed in the "Custom Defines" text box as

MSP_UART=SERIAL_PORT_USART1

@Scavanger
Copy link
Contributor Author

I see.
But this should be documented.
The FAQ in the wiki says that only USE_MSP_UART has to be activated to activate MSP on UART1.

@haslinghuis
Copy link
Member

FAQ

#if defined(USE_MSP_UART)
serialPortConfig_t * uart1Config = serialFindPortConfigurationMutable(USE_MSP_UART);
if (uart1Config) {
uart1Config->functionMask = FUNCTION_MSP;
}
#endif

Have not tested this application. Maybe this combination works:

EXTRA_FLAGS="-DUSE_MSP_UART -D'MSP_UART=SERIAL_PORT_USART1'"

@Scavanger
Copy link
Contributor Author

Have not tested this application. Maybe this combination works:

EXTRA_FLAGS="-DUSE_MSP_UART -D'MSP_UART=SERIAL_PORT_USART1'"

No need to overcomplicate things:

make [TARGET] EXTRA_FLAGS="-DMSP_UART=SERIAL_PORT_USART1"

Works like a charme, I have just tested.

Configurator cloud build also work with MSP_UART=SERIAL_PORT_USART1

@haslinghuis
Copy link
Member

Thanks for testing. Did not think about this application while adding as now we can use other ports for MSP.

Also found the change

@Scavanger
Copy link
Contributor Author

I came across this because I found out that all FCs can also be flashed with the STM32CubeProgrammer and a simple USB/TTL Converter via UART1 and 3 without further requirements, keyword broken USB port.
Only a "rescue firmware" in which MSP is activated by default on a UART needs to be created.

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

Successfully merging a pull request may close this issue.

3 participants