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

KSDK2 fixes #1817

Merged
merged 3 commits into from
May 31, 2016
Merged

KSDK2 fixes #1817

merged 3 commits into from
May 31, 2016

Conversation

c1728p9
Copy link
Contributor

@c1728p9 c1728p9 commented May 31, 2016

Fix SPI and IIC problems introduced with the switch to KSDK2.

On repeated starts the flag to indicate this is not being set
properly.  Because of this the transfer fails.  This patch
keeps track of the last transfer to determine if a repeated
start should be sent and sets the KSDK flags appropriately.
Address passed into the mbed I2C API are expected to be 8 bit and
include the read/write flag.  KSDK2 expects a 7 bit address without
this flag.  This patch shifts the address passed into the KSDK by 1
so it is in the correct format.
@c1728p9
Copy link
Contributor Author

c1728p9 commented May 31, 2016

@mbed-bot: TEST

HOST_OSES=windows
BUILD_TOOLCHAINS=GCC_ARM
TARGETS=LPC1768,NRF51_DK,K64F

@mbed-bot
Copy link

[Build 419]
SUCCESS: Building succeeded and tests were run! Be sure to check the test results

@@ -108,7 +108,7 @@ int spi_master_write(spi_t *obj, int value) {
// wait rx buffer full
while (!spi_readable(obj));
rx_data = DSPI_ReadData(spi_address[obj->instance]);
DSPI_ClearStatusFlags(spi_address[obj->instance], kDSPI_RxFifoDrainRequestFlag);
DSPI_ClearStatusFlags(spi_address[obj->instance], kDSPI_RxFifoDrainRequestFlag | kDSPI_EndOfQueueFlag);
Copy link
Contributor

Choose a reason for hiding this comment

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

This fix should be applied to K22F as well, they share the same peripheral

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Good catch, I'll update it

When the function spi_master_write is called a transfer will occur
and set the end of queue flag.  This disables further SPI transfers
which causes the next SPI transfer to hang forever.

This patch clears the end of queue flag so SPI does not hang after
the first transfer.
@0xc0170
Copy link
Contributor

0xc0170 commented May 31, 2016

LGTM

@0xc0170 0xc0170 merged commit 64edea6 into ARMmbed:master May 31, 2016
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.

None yet

3 participants