Skip to content

Remove byte sent at 9600 baud on init on NRF51-DK #1474

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
Dec 19, 2015

Conversation

c1728p9
Copy link
Contributor

@c1728p9 c1728p9 commented Dec 14, 2015

Remove the dummy byte sent on init and instead keep track of if the
the TX line is idle. This fixes the junk data seen on the serial port
when it is initialized.

The code to send a dummy byte was added in the following commit:
91a77d7

@0xc0170
Copy link
Contributor

0xc0170 commented Dec 14, 2015

What's the function of idle variable? It's 1 only after init, once something is sent, it becomes 0 and never returns to 1.

@sg- review please

@sg-
Copy link
Contributor

sg- commented Dec 14, 2015

I think a more simple solution would be to wait baud/clk cycles and remove the flag.

@sg-
Copy link
Contributor

sg- commented Dec 15, 2015

Looks good!

@0xc0170
Copy link
Contributor

0xc0170 commented Dec 15, 2015

+1, will merge once I push the release, will happen soon

Disconnect the TX line before sending a dummy byte, and wait until the
dummy byte is completely sent before continuing.   This prevents
the byte from getting sent on init or re-init of the uart.
Add support for the baudrate 56000.  This is not documented in the
datasheet, but Nordic has indicated in can be used by setting the
BAUD register to 56000.
@c1728p9
Copy link
Contributor Author

c1728p9 commented Dec 18, 2015

Rebased onto master and added support for 56000 baud.

sg- added a commit that referenced this pull request Dec 19, 2015
Remove byte sent at 9600 baud on init on NRF51-DK
@sg- sg- merged commit a8616dc into ARMmbed:master Dec 19, 2015
@leibin2014
Copy link
Contributor

Hi guys,
Looks like there is a small mistake on adding support for 56000 baud. After adding this baud, the array size also need to be added by 1. It will be 18, not 17 as now.

static const int acceptedSpeeds[17][2] = { // Here should be [18][2]
{1200, UART_BAUDRATE_BAUDRATE_Baud1200},
{2400, UART_BAUDRATE_BAUDRATE_Baud2400},
{4800, UART_BAUDRATE_BAUDRATE_Baud4800},
{9600, UART_BAUDRATE_BAUDRATE_Baud9600},
{14400, UART_BAUDRATE_BAUDRATE_Baud14400},
{19200, UART_BAUDRATE_BAUDRATE_Baud19200},
{28800, UART_BAUDRATE_BAUDRATE_Baud28800},
{31250, (0x00800000UL) /* 31250 baud /},
{38400, UART_BAUDRATE_BAUDRATE_Baud38400},
{56000, (0x00E51000UL) /
56000 baud */},
{57600, UART_BAUDRATE_BAUDRATE_Baud57600},
{76800, UART_BAUDRATE_BAUDRATE_Baud76800},
{115200, UART_BAUDRATE_BAUDRATE_Baud115200},
{230400, UART_BAUDRATE_BAUDRATE_Baud230400},
{250000, UART_BAUDRATE_BAUDRATE_Baud250000},
{460800, UART_BAUDRATE_BAUDRATE_Baud460800},
{921600, UART_BAUDRATE_BAUDRATE_Baud921600},
{1000000, UART_BAUDRATE_BAUDRATE_Baud1M}
};

@c1728p9 c1728p9 deleted the uart_null_byte branch December 22, 2015 05:54
@c1728p9
Copy link
Contributor Author

c1728p9 commented Dec 22, 2015

Hi @leibin2014 , good catch. I pushed up #1479 to fix this.

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

Successfully merging this pull request may close these issues.

4 participants