Skip to content

STM32L0/4 Enable use of LPUART in stop mode #5941

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

Merged
merged 2 commits into from
Feb 12, 2018

Conversation

marcemmers
Copy link
Contributor

@marcemmers marcemmers commented Jan 25, 2018

Description

Working on using the LPUART in stop mode.
Always switching to LSE when available when baudrates are below or equal to 9600.

This is at least still blocked by the SerialBase::attach() where sleep_manager_lock_deep_sleep() is called.

Status

IN DEVELOPMENT

Deploy notes

This breaks when compiling on an STM32L4 because the HAL doesn't have the function HAL_UARTEx_EnableClockStopMode(). The HAL should have the same function as the STM32L0 has because the peripheral also has the same settings. For example, see chapter 41.4.11 of the ST RM0351 and the UCESM bit in CR3.

@mbed-ci
Copy link

mbed-ci commented Jan 25, 2018

Automatic CI verification build not done, please verify manually.

@jeromecoutant
Copy link
Collaborator

Hi
I am checking the L4 issue... strange...
Thx

@jeromecoutant
Copy link
Collaborator

This PR needs #5947 and #5943

@marcemmers
Copy link
Contributor Author

Now that I've learned that normal uarts can also wake up from stop mode I'm wondering if this PR isn't a bit shortsighted to only address the LP uart.

For the wake up to work we have to use the LSE or HSI for the uart clock. If we change the preferred clock from SYSCLK to HSI we might run into some issues when the device is clocked by an HSE and the HSI gets disabled.

I don't know if its better to do this in a separate PR after this one is merged or do it here.

@cmonr
Copy link
Contributor

cmonr commented Jan 30, 2018

@marcemmers @jeromecoutant I've removed the Needs PR label for now, since the second link referenced is an issue. We'll change it back once #5943 turns into a PR.

@marcemmers
Copy link
Contributor Author

@cmonr In my eyes #5943 is not really necessary for this PR to be implemented. I might have worded is poorly in my first description seeing that this PR is not really useful until the SerialBase functionality is modified but it can still be implemented.

My question from my earlier comment is still valid though

@0xc0170
Copy link
Contributor

0xc0170 commented Jan 31, 2018

Now that I've learned that normal uarts can also wake up from stop mode I'm wondering if this PR isn't a bit shortsighted to only address the LP uart.

For the wake up to work we have to use the LSE or HSI for the uart clock. If we change the preferred clock from SYSCLK to HSI we might run into some issues when the device is clocked by an HSE and the HSI gets disabled.

I don't know if its better to do this in a separate PR after this one is merged or do it here.

@jeromecoutant @bcostm Suggestions for this pull request?

SerialBase attach and locking is a separate issue. I am interested in the target side things if this PR would be beneficial for the current version as it is

@@ -393,32 +393,30 @@ void serial_baud(serial_t *obj, int baudrate)
struct serial_s *obj_s = SERIAL_S(obj);

obj_s->baudrate = baudrate;
Copy link
Contributor

@bcostm bcostm Jan 31, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not related to this PR, but maybe put back the previous baudrate if the init_uart function has returned a FAIL ?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We could but it still doesn't really notify you that the operation has failed. You would have to check wat the actual baudrate is after te operation to verify it succeeded.

@cmonr
Copy link
Contributor

cmonr commented Feb 5, 2018

@marcemmers Could you rebase this PR instead of merging it, while we wait for @jeromecoutant'd feedback?

@marcemmers
Copy link
Contributor Author

Should be ok now @cmonr

@0xc0170
Copy link
Contributor

0xc0170 commented Feb 6, 2018

Should be ok now @cmonr

👍

@jeromecoutant @bcostm Please review

Copy link
Contributor

@bcostm bcostm left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@0xc0170
Copy link
Contributor

0xc0170 commented Feb 7, 2018

/morph build

@mbed-ci
Copy link

mbed-ci commented Feb 7, 2018

Build : SUCCESS

Build number : 1080
Build artifacts/logs : http://mbed-os.s3-website-eu-west-1.amazonaws.com/?prefix=builds/5941/

Triggering tests

/morph test
/morph uvisor-test
/morph export-build

@mbed-ci
Copy link

mbed-ci commented Feb 7, 2018

@mbed-ci
Copy link

mbed-ci commented Feb 7, 2018

@cmonr
Copy link
Contributor

cmonr commented Feb 7, 2018

Windows export machine closed too soon.
/morph export-build

@0xc0170
Copy link
Contributor

0xc0170 commented Feb 8, 2018

/morph export-build

@mbed-ci
Copy link

mbed-ci commented Feb 8, 2018

@0xc0170
Copy link
Contributor

0xc0170 commented Feb 8, 2018

@marcemmers Can you sign please https://os.mbed.com/contributor_agreement/ ?

@marcemmers
Copy link
Contributor Author

@0xc0170 I thought I already did? If I click on the link it says i have already signed it 24 januari. I have linked this account my mbed account under account settings -> connected accounts -> github.

@0xc0170
Copy link
Contributor

0xc0170 commented Feb 9, 2018

@0xc0170 I thought I already did? If I click on the link it says i have already signed it 24 januari. I have linked this account my mbed account under account settings -> connected accounts -> github.

Whats your nick? I could not locate marcemmers

@marcemmers
Copy link
Contributor Author

@0xc0170 its memmers, it was already taken on github ;)

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

Successfully merging this pull request may close these issues.

6 participants