• AVR Freaks

Harmony v.2.06, static SPI continuous slave receiver

Author
Deenayd
Super Member
  • Total Posts : 905
  • Reward points : 0
  • Joined: 2004/09/08 06:15:13
  • Location: Poland
  • Status: offline
2019/05/14 04:57:17 (permalink)
0

Harmony v.2.06, static SPI continuous slave receiver

Hello,
 
 
I'm using Harmony 2.06 and trying to implement a continuous SPI slave receiver (SDO is not used). I'm using interrupt mode, without dma, static SPI implementation.
 
I'm setting up a set of buffers and adding tasks to SPI. Taking care to add new tasks as I read data from the buffers, so tasks should never end.
 
 
So far I have found two... well... strange implementations:
 
First is:
Near end of implementation of DRV_SPI0_BufferAddRead2 there is following code:
SYS_INT_SourceEnable(INT_SOURCE_SPI_2_TRANSMIT);

Well, in master mode this would probably work as in master mode dummy writes are automatically enabled when scheduling a "read only" task. In slave mode dummy writes are NOT done (they are not needed). No dummy writes = no transmit interrupts. I guess we should enable receive interrupt, not transmit.
 
 
Second is:
            /* Flush out the Receive buffer */
            PLIB_SPI_BufferClear(${PLIB_INSTANCE});

This code is executed on interrupt, when starting transfer of next buffer, after completing previous one. Why is it clearing hardware buffers? It causes data loss...
 
 
Are those errors indeed Harmony errors or am I doing something wrong?

Slawek Piotrowski
Rejestracja Czasu Pracy Ewidencja Czasu Pracy
#1

0 Replies Related Threads

    Jump to:
    © 2019 APG vNext Commercial Version 4.5