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

Nuvoton: Fix issues with SPI #6466

Merged
merged 5 commits into from Apr 16, 2018

Conversation

Projects
None yet
4 participants
@ccli8
Contributor

ccli8 commented Mar 27, 2018

Description

This PR includes fixes with SPI for Nuvoton targets.

Target

  • NUMAKER_PFM_NUC472
  • NUMAKER_PFM_M453
  • NUMAKER_PFM_M487
  • NUMAKER_PFM_NANO130

Update

  1. Introduce SPI_ENABLE_SYNC/SPI_DISABLE_SYNC to simplify SPI enable/disable control.
  2. Use vector rather than SPI enable bit to judge if asynchronous transfer is on-going (spi_active).
  3. Fix SPI DMA transfer.
  4. Refine SPI code.

Pull request type

[x] Fix
[ ] Refactor
[ ] New target
[ ] Feature
[ ] Breaking change

ccli8 added some commits Mar 26, 2018

[Nuvoton] Fix SPI DMA transfer
1. Disable unnecessary TX/RX threshold interrupts to avoid potential trap in DMA transfer
2. Start TX/RX DMA transfer simultaneously to fit H/W spec and avoid potential RX FIFO overflow issue
[Nuvoton] Refine SPI code
1. Remove dead code
2. Remove space in empty lines
3. Fix compile warnings
4. Fix some comments
* user shall clear the SPIEN (SPIx_CTL[0]) and confirm the SPIENSTS (SPIx_STATUS[15]) is 0
* (by SPI_DISABLE_SYNC here).
*/
__STATIC_INLINE void SPI_ENABLE_SYNC(SPI_T *spi_base)

This comment has been minimized.

@0xc0170

0xc0170 Apr 4, 2018

Member

static inline should do the job here (all compilers)

This comment has been minimized.

@ccli8

ccli8 Apr 9, 2018

Contributor

@0xc0170 Could you give more details?

This comment has been minimized.

@ccli8

ccli8 Apr 10, 2018

Contributor

@0xc0170 I don't know your point. Could you explain it?

This comment has been minimized.

@0xc0170

0xc0170 Apr 10, 2018

Member

static inline should do the job. I believe this macro comes from CMSIS that is also valid so no biggy

This comment has been minimized.

@0xc0170

0xc0170 Apr 10, 2018

Member

If you want to update your PR , let us know. We shall trigger CI asap

This comment has been minimized.

@ccli8

ccli8 Apr 11, 2018

Contributor

@0xc0170 Yes, __STATIC_INLINE comes from CMSIS. I won't make change about it. Just trigger CI.

* To fix it, we don't enable SPI TX/RX threshold interrupts but keep SPI vector handler set to be called
* in PDMA TX/RX transfer done interrupt handlers (spi_dma_handler_tx/spi_dma_handler_rx).
*/
#if 0

This comment has been minimized.

@0xc0170

0xc0170 Apr 4, 2018

Member

Can we remove these, we should not leave #if 0 in the code.

This comment has been minimized.

@ccli8

ccli8 Apr 10, 2018

Contributor

@0xc0170 I removed #if 0 in 571e890.

* To fix it, we don't enable SPI TX/RX threshold interrupts but keep SPI vector handler set to be called
* in PDMA TX/RX transfer done interrupt handlers (spi_dma_handler_tx/spi_dma_handler_rx).
*/
#if 0

This comment has been minimized.

@0xc0170

0xc0170 Apr 4, 2018

Member

same as previously for #if 0

This comment has been minimized.

@ccli8

ccli8 Apr 9, 2018

Contributor

@0xc0170 Same as above for #if 0.

@0xc0170 0xc0170 added needs: work and removed needs: review labels Apr 4, 2018

@0xc0170 0xc0170 added needs: review and removed needs: work labels Apr 9, 2018

@0xc0170 0xc0170 added needs: CI and removed needs: review labels Apr 11, 2018

@0xc0170

This comment has been minimized.

Member

0xc0170 commented Apr 11, 2018

/morph build

@mbed-ci

This comment has been minimized.

mbed-ci commented Apr 11, 2018

Build : SUCCESS

Build number : 1721
Build artifacts/logs : http://mbed-os.s3-website-eu-west-1.amazonaws.com/?prefix=builds/6466/

Triggering tests

/morph test
/morph uvisor-test
/morph export-build
/morph mbed2-build

@mbed-ci

This comment has been minimized.

@mbed-ci

This comment has been minimized.

@ccli8

This comment has been minimized.

Contributor

ccli8 commented Apr 16, 2018

@0xc0170 @cmonr Ready to merge?

@0xc0170

This comment has been minimized.

Member

0xc0170 commented Apr 16, 2018

@0xc0170 @cmonr Ready to merge?

Yes, should be integrated today during gatekeeping

@cmonr cmonr merged commit f73415e into ARMmbed:master Apr 16, 2018

12 checks passed

AWS-CI uVisor Build & Test Success
Details
ci-morph-build build completed
Details
ci-morph-exporter build completed
Details
ci-morph-mbed2-build build completed
Details
ci-morph-test test completed
Details
continuous-integration/jenkins/pr-head This commit looks good
Details
continuous-integration/travis-ci/pr The Travis CI build passed
Details
travis-ci/docs Local docs testing has passed
Details
travis-ci/events Passed, runtime is 8856 cycles (-418 cycles)
Details
travis-ci/gitattributestest Local gitattributestest testing has passed
Details
travis-ci/littlefs Passed, code size is 10092B (+0.00%)
Details
travis-ci/tools Local tools testing has passed
Details

@cmonr cmonr removed the ready for merge label Apr 16, 2018

@ccli8 ccli8 deleted the OpenNuvoton:nuvoton_fix_spi branch Apr 17, 2018

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