Skip to content

kinetis: Clean up SPI module power handling#9438

Merged
PeterKietzmann merged 1 commit intoRIOT-OS:masterfrom
jnohlgard:pr/kinetis-spi-scgc
Jun 28, 2018
Merged

kinetis: Clean up SPI module power handling#9438
PeterKietzmann merged 1 commit intoRIOT-OS:masterfrom
jnohlgard:pr/kinetis-spi-scgc

Conversation

@jnohlgard
Copy link
Copy Markdown
Member

Contribution description

Fixes a problem with hardware CS when using slow SPI speeds, mentioned in #6437 (comment)

The problem was identified as the module was being disabled before the CS line has been deasserted when using fast core clocks in combination with slow SPI speeds. By setting the HALT bit and waiting for the TXRXS status flag to become unset we allow the hardware to acknowledge that the transfer is completely finished and we can finally disable the module clocks.

Issues/PRs references

#6437

Fixes a problem with hardware CS when using slow SPI speeds,
mentioned in RIOT-OS#6437 (comment)
@jnohlgard jnohlgard added Type: bug The issue reports a bug / The PR fixes a bug (including spelling errors) Platform: ARM Platform: This PR/issue effects ARM-based platforms Impact: minor The PR is small in size and might only require a quick look of a knowledgeable reviewer Area: drivers Area: Device drivers CI: ready for build If set, CI server will compile all applications for all available boards for the labeled PR labels Jun 27, 2018
@jnohlgard jnohlgard added this to the Release 2018.07 milestone Jun 27, 2018
@jnohlgard jnohlgard requested a review from PeterKietzmann June 27, 2018 17:26
@jnohlgard
Copy link
Copy Markdown
Member Author

Tested on Mulle with tests/lis3dh, and examples/gnrc_networking (at86rf2xx with modified configuration to use SPI_CLK_100KHZ for clocking)

@PeterKietzmann
Copy link
Copy Markdown
Member

master
100 kHz
master_100khz
400 kHz
master_400khz
bench 1MHz

### Running some benchmarks, all values in [us] ###

 1 - write 1000 times 1 byte:                   11334
 2 - write 1000 times 2 byte:                   20334
 3 - write 1000 times 100 byte:                 951292
 4 - write 1000 times 1 byte to register:       22417
 5 - write 1000 times 2 byte to register:       31501
 6 - write 1000 times 100 byte to register:     962543
 7 - read 1000 times 2 byte:                    20376
 8 - read 1000 times 100 byte:                  951459
 9 - read 1000 times 2 byte from register:      31626
10 - read 1000 times 100 byte from register:    962667
11 - transfer 1000 times 2 byte:                20293
12 - transfer 1000 times 100 byte:              951334
13 - transfer 1000 times 2 byte to register:    31501
14 - transfer 1000 times 100 byte to register:  962542
-- - SUM:                                       5931219

with fix
100 kHz
fix_100khz
400 kHz
fix_400khz
bench 1MHz

### Running some benchmarks, all values in [us] ###

 1 - write 1000 times 1 byte:                   11417
 2 - write 1000 times 2 byte:                   20251
 3 - write 1000 times 100 byte:                 951168
 4 - write 1000 times 1 byte to register:       22417
 5 - write 1000 times 2 byte to register:       31376
 6 - write 1000 times 100 byte to register:     962376
 7 - read 1000 times 2 byte:                    20459
 8 - read 1000 times 100 byte:                  951459
 9 - read 1000 times 2 byte from register:      31668
10 - read 1000 times 100 byte from register:    962626
11 - transfer 1000 times 2 byte:                20293
12 - transfer 1000 times 100 byte:              951334
13 - transfer 1000 times 2 byte to register:    31459
14 - transfer 1000 times 100 byte to register:  962500
-- - SUM:                                       5930803

Copy link
Copy Markdown
Member

@PeterKietzmann PeterKietzmann left a comment

Choose a reason for hiding this comment

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

Tested ACK

@PeterKietzmann PeterKietzmann merged commit e684f49 into RIOT-OS:master Jun 28, 2018
@jnohlgard jnohlgard deleted the pr/kinetis-spi-scgc branch September 24, 2018 09:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Area: drivers Area: Device drivers CI: ready for build If set, CI server will compile all applications for all available boards for the labeled PR Impact: minor The PR is small in size and might only require a quick look of a knowledgeable reviewer Platform: ARM Platform: This PR/issue effects ARM-based platforms Type: bug The issue reports a bug / The PR fixes a bug (including spelling errors)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants