Skip to main content
Clonimus74
Senior II
November 7, 2017
Solved

Problem waking from Stop Mode 2 using LPUART

  • November 7, 2017
  • 1 reply
  • 2156 views
Posted on November 07, 2017 at 12:49

The original post was too long to process during our migration. Please click on the attachment to read the original post.
    This topic has been closed for replies.
    Best answer by Clonimus74
    Posted on February 11, 2018 at 13:50

    Seems I found the problem.

    The CubeMX generated code enters the 'default' trimming value for the HSI, which is according to the datasheet and CubeMX 0x10 (16).

    LL_RCC_HSI_SetCalibTrimming(16);

    This causes large deviations of the clock and so the baud rate is off and frame error occurs.

    If I mask this line in the code I see the

    default value is actually 0x40 and not 0x10

     

    (HSITRIM in ICSCR), and in this case all functions well.

    I will add a discussion regarding this to see STs comment.

    1 reply

    Clonimus74
    Senior II
    November 9, 2017
    Posted on November 09, 2017 at 12:36

    no one is able to help?

    Clonimus74
    Clonimus74AuthorBest answer
    Senior II
    February 11, 2018
    Posted on February 11, 2018 at 13:50

    Seems I found the problem.

    The CubeMX generated code enters the 'default' trimming value for the HSI, which is according to the datasheet and CubeMX 0x10 (16).

    LL_RCC_HSI_SetCalibTrimming(16);

    This causes large deviations of the clock and so the baud rate is off and frame error occurs.

    If I mask this line in the code I see the

    default value is actually 0x40 and not 0x10

     

    (HSITRIM in ICSCR), and in this case all functions well.

    I will add a discussion regarding this to see STs comment.

    Ray Ozzie
    Associate
    March 24, 2018
    Posted on March 24, 2018 at 14:36

    May I trouble you with a quick q?

    i have a new application that spends most of its time in STOP2 mode, but also needs to accept inbound comms at 9600bps reliably.  It doesn’t matter how much power it takes or what clock is used once awakened, but inbound 9600bps comms must be reliable with no dropped chars or framing errors.

    i have an stm32l4+ prototype board, and for the life of me I cannot get it to wake from stop2 on lpuart reception.  Nor can I find sample code or guidelines; your code above seems the best that I’ve been able to find, and it still doesn’t work for me. I must say that I am totally unclear on what needs to be re-enabled manually after wake up, since I had assumed that all clocks/etc were just restarted automatically when it wakes into run mode.

    i have not yet tried setting the trim, but before I do, I just have a couple basic questions:

    - can lpuart1 be configured as above, using hsi, to reliably wake up and receive at 9600bps? (If so, is there an example project lying around somewhere that I can test and adapt?)

    - or, alternatively, must I redesign my board to have an external crystal and thus use LSE for lpuart1?

    This is kind of a time sensitive question because I have a 1 week deadline for design changes on the next rev of the board.

    thanks much for your generous assistance.