Skip to content

Buffered STDIN/STDOUT crashes on RTL8195AM and Ublox ODIN W2 #8081

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

Closed
SeppoTakalo opened this issue Sep 11, 2018 · 27 comments
Closed

Buffered STDIN/STDOUT crashes on RTL8195AM and Ublox ODIN W2 #8081

SeppoTakalo opened this issue Sep 11, 2018 · 27 comments

Comments

@SeppoTakalo
Copy link
Contributor

Description

When sending bytes bidirectionally to Uart that handles STDIN/STDOUT the Realtek 8195 seems to crash.
This is basically same issue that was reported in #6358 but requires faster speed than what humans can type.

To reproduce:

mbed new serial-test
cd serial-test
cd mbed-os
git checkout master
cd ..

Then create main.cpp and mbed_app.json as follows:

main.cpp

#include "mbed.h"

int main() {
    printf("Started!\r\n");

    while (true) {
        int c = getchar();
        if (c != EOF) {
            printf("Input: %c\r\n", c);
        } else {
            return 0;
        }
    }
}

mbed_app.json

{
    "target_overrides": {
        "*": {
            "platform.stdio-buffered-serial": true
        }
    }
}

Now compile and run the program.

It first seems to work, if you type in anything. But if you copy&paste some string that is longer that 10 characters, then it crashes.

So for example, paste following to the serial terminal: 0123456789A
Output would be:

Started!
Input: 0
Input: 1
Input: 2
Input: 3
Input: 4
Input: 5
Input: 6
Input: 7

And then it does not respond anymore

Note: If you set stdio-buffered-serial to false it does not crash.

Issue request type

[ ] Question
[ ] Enhancement
[X] Bug

@SeppoTakalo SeppoTakalo changed the title Buffered STDIN/STDOUT crashed on Realtek RTL8195AM Buffered STDIN/STDOUT crashes on Realtek RTL8195AM Sep 11, 2018
@SeppoTakalo
Copy link
Contributor Author

SeppoTakalo commented Sep 13, 2018

Just verified that Ublox EVK ODIN W2 also crashes somehow if baud rate is set to 115200 and paste a bit longer text:
0123456789A0123456789A0123456789A0123456789A0123456789A0123456789A0123456789A0123456789A0123456789A

So for Ublox EVK ODIN W2 use following mbed_app.json

{
    "target_overrides": {
        "*": {
            "platform.stdio-buffered-serial": true,
            "platform.stdio-baud-rate": 115200
        }
    }
}

[Mirrored to Jira]

@SeppoTakalo SeppoTakalo changed the title Buffered STDIN/STDOUT crashes on Realtek RTL8195AM Buffered STDIN/STDOUT crashes on RTL8195AM and Ublox ODIN W2 Sep 13, 2018
@SeppoTakalo
Copy link
Contributor Author

SeppoTakalo commented Sep 13, 2018

Verified that does not crash on K66F
[Mirrored to Jira]

@samchuarm
Copy link

samchuarm commented Sep 20, 2018

adding @ARMmbed/team-realtek @M-ichae-l , Hi Michael, please help look into this STDIN/STDOUT crash and address it for RTL8195AM. Thanks.
[Mirrored to Jira]

@samchuarm
Copy link

samchuarm commented Oct 2, 2018

Adding @AdamZhang0124
[Mirrored to Jira]

@ARMmbed ARMmbed deleted a comment from ciarmcom Oct 2, 2018
@adbridge
Copy link
Contributor

adbridge commented Oct 4, 2018

Internal Jira reference: https://jira.arm.com/browse/IOTPART-6510

@jenia81
Copy link

jenia81 commented Oct 11, 2018

This issue also affects SDA (secure device access) project that runs on Sales Demo Device (WEM device, modification of Ublox Odin W2). When running SDA example application with Serial it crashes from time to time. @TaniaMirzin, can provide more details if needed

@samchuarm
Copy link

@M-ichae-l , can you please verify this STDIN/STDOUT crash for RTL8195AM?

@M-ichae-l
Copy link
Contributor

M-ichae-l commented Nov 15, 2018

@SeppoTakalo
I have followed your process. However, I am not able to produce the error with all three compilers (GCC, ARM, and IAR). My side the UART is working perfectly. Could you please check again? Thank you.

@samchuarm
Copy link

Hi @SeppoTakalo , as we can't reproduce the crash, can you help comment on the reproduce steps? Thanks

@SeppoTakalo
Copy link
Contributor Author

=========================================================

ROM Version: 0.3

Build ToolChain Version: gcc version 4.8.3 (Realtek ASDK-4.8.3p1 Build 2003) 

=========================================================
Check boot type form eFuse                                                             
SPI Initial                                                                            
Image1 length: 0x4398, Image Addr: 0x10000bc8                                          
Image1 Validate OK, Going jump to Image1                                               
SDR Controller Init                                                                    
Started!
=========================================================

ROM Version: 0.3

Build ToolChain Version: gcc version 4.8.3 (Realtek ASDK-4.8.3p1 Build 2003) 

=========================================================
Check boot type form eFuse
SPI Initial
Image1 length: 0x4398, Image Addr: 0x10000bc8
Image1 Validate OK, Going jump to Image1
SDR Controller Init
Started!
Input: 0
Input: 1
Input: 2
Input: 3
Input: 4
Input: 5
Input: 6
Input: 7

Crash same way as previously.
How can you not reproduce this issue. Do we have different HW revisions, or different compiler?

arm-none-eabi-gcc (GNU Tools for ARM Embedded Processors 6-2017-q2-update) 6.3.1 20170620 (release)

Are you entering the characters by hand or copy&pasting?
Because if you enter slowly enough, it does not crash.

@M-ichae-l
Copy link
Contributor

@SeppoTakalo

I have followed your process.

Where did you put the main.cpp and mbed_app.json ?
I put them under mbed-os folder.

@SeppoTakalo
Copy link
Contributor Author

As normal application, not inside of mbed-os.

See the first message.

mbed new serial-test
cd serial-test

Now create those files.

Then we can checkout mbed-os master

cd mbed-os
git checkout master
cd ..

@tung7970
Copy link
Contributor

@M-ichae-l Can you share your binary file for @SeppoTakalo to try ?
@SeppoTakalo Can you do the same too ?

@M-ichae-l
Copy link
Contributor

@SeppoTakalo I am now able to produce the error. I am working on it.
@tung7970 thank you for the suggestion.

@samchuarm
Copy link

Hi @M-ichae-l , any update on this? Thanks.

@M-ichae-l
Copy link
Contributor

M-ichae-l commented Nov 27, 2018

@samchuarm still processing.
The device hangs once the data more than 7 for example "0123456" is the max passed data. I wonder if it is a FIFO issue.

@samchuarm
Copy link

Hi @M-ichae-l , has there been any progress on this issue? Thanks.

@samchuarm
Copy link

Hi @M-ichae-l , any update on this?

@M-ichae-l
Copy link
Contributor

@samchuarm it is still under processing.

@samchuarm
Copy link

Hi @M-ichae-l , is there any way we can get this issue progressed? Thanks.

@samchuarm
Copy link

Hi @M-ichae-l , any update on this?

@M-ichae-l
Copy link
Contributor

Hi, @samchuarm
I am not working on this issue right now. I will continue working on this issue when I have done others.

@samchuarm
Copy link

Hi @ARMmbed/team-realtek , this has been open for months. Could we get the issue progressed and fixed? Thanks.

@AdamZhang0124
Copy link
Contributor

Hi @samchuarm ,
I have been assigned to solve this problem. I have checked and tested our SDK, the logUART TX RX function is running fine without aforementioned 'crash' problem.
I speculate that the problem may relate to rx_irq or tx_irq, maybe somewhere blocks the interrupts from triggering after too many characters received concurrently.
I am still investigate the root cause now and I will let you know the results, thanks.

@AdamZhang0124
Copy link
Contributor

AdamZhang0124 commented Mar 1, 2019

Hi @samchuarm ,
Good news! The root cause of this issue has been spotted and fixed. Now we are checking if the solution would affect other functions. The release of the solution can be expected soon.

@AdamZhang0124
Copy link
Contributor

Hi @SeppoTakalo and @samchuarm ,

The fix for this issue has been committed with the PR of #9923. Please help to review it. Thanks!

@samchuarm
Copy link

Adam, thanks for your effort fixing the issue.

Hi @SeppoTakalo , since the PR# #9923 has been approved, can this issue be closed now? Thanks.

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

No branches or pull requests

10 participants