Hot!MCC SPI SPIx_Exchange16bitBuffer() failure

Author
BumpSplat
Senior Member
  • Total Posts : 135
  • Reward points : 0
  • Joined: 2017/11/06 13:23:11
  • Location: Bend, OR
  • Status: offline
2018/05/21 13:01:22 (permalink)
0

MCC SPI SPIx_Exchange16bitBuffer() failure

Has anyone gotten these functions to work?
 
dummy_stuff = SPI2_Exchange16bit(data); 
// This works but is limited to 127 byte transfers.  My buffer pass operation is verified to pass through the 256 times but only 128B of data are read back from my flash. 
 
dummy_stuff = SPI2_Exchange16bitBuffer(write_buffer, 18, read_buffer);
// This works up to 16 bytes of code.  The return value is 1/2 of the total I pass in. For example, if I pass in a 16 byte count it returns 8.  Very strange..
 
My desire is to simply write to a page of flash (256 16b int).  I can post more code but I'm pretty sure the issue isn't on my side.  The exchange with no buffer may be inherently limited as they expect you'd go to a buffer transfer for langer transfers.
 
Thanks,
 
Tim
#1

7 Replies Related Threads

    BumpSplat
    Senior Member
    • Total Posts : 135
    • Reward points : 0
    • Joined: 2017/11/06 13:23:11
    • Location: Bend, OR
    • Status: offline
    Re: MCC SPI SPIx_Exchange16bitBuffer() failure 2018/05/21 13:05:52 (permalink)
    0
    ..
    post edited by BumpSplat - 2018/05/21 13:11:50
    #2
    Gort2015
    Klaatu Barada Nikto
    • Total Posts : 2645
    • Reward points : 0
    • Joined: 2015/04/30 10:49:57
    • Location: 0
    • Status: offline
    Re: MCC SPI SPIx_Exchange16bitBuffer() failure 2018/05/21 15:12:36 (permalink)
    0
    The h/w buffer is a fixed size.  Maybe 8 words.
    You maybe better off writing your own spi functions.
     
    I don't use mcc but it sounds like it is using dma, if a lot of data is transfered then dma is what is needed.

    MPLab X playing up, bug in your code? Nevermind, Star Trek:Discovery will be with us soon.
    https://www.youtube.com/watch?v=Iu1qa8N2ID0
    + ST:Continues, "What Ships are Made for", Q's back.
    #3
    pr.mchp
    New Member
    • Total Posts : 20
    • Reward points : 0
    • Joined: 2015/03/23 06:20:48
    • Location: 0
    • Status: offline
    Re: MCC SPI SPIx_Exchange16bitBuffer() failure 2018/07/11 05:38:54 (permalink)
    0
    Hi Tim
    Can you please share your code to analyse the issue.
     
    Thanks
    MCC team
    #4
    katela
    Super Member
    • Total Posts : 854
    • Reward points : 0
    • Joined: 2013/06/11 05:25:18
    • Location: South Africa
    • Status: offline
    Re: MCC SPI SPIx_Exchange16bitBuffer() failure 2018/07/11 08:51:46 (permalink)
    0
    techSavy
    Hi Tim
    Can you please share your code to analyse the issue.
     
    Thanks
    MCC team


    After 2 months! You guys should have assisted long time ago.

    Free online Microcontroller Tutorials and Projects for Hobbyists and students. From beginners to advanced. Website: www.studentcompanion.co.za
    YouTube Tutorials: https://www.youtube.com/user/StudentCompanionSA
    #5
    jaya chandran
    New Member
    • Total Posts : 4
    • Reward points : 0
    • Joined: 2015/02/25 01:32:29
    • Location: 0
    • Status: offline
    Re: MCC SPI SPIx_Exchange16bitBuffer() failure 2018/07/31 00:21:17 (permalink)
    0
    Hi, 
     
    SPI2_Exchange16bit and SPI2_Exchange16Buffer function working fine for n number bytes read and write. i tried continues read and write 1024Bytes. (I used to two controller to check, One acts as master another acts as slave. Used for logic analyzer to check data transfer).
    Flash memory is able read or wirte based on byte wise or page wise. Page size might be 128 or based on flash variant. 
     
    Regards,
    Jayachandran D
     
    #6
    BumpSplat
    Senior Member
    • Total Posts : 135
    • Reward points : 0
    • Joined: 2017/11/06 13:23:11
    • Location: Bend, OR
    • Status: offline
    Re: MCC SPI SPIx_Exchange16bitBuffer() failure 2018/08/05 11:10:30 (permalink)
    3 (1)
    Closing this one out.  It looks like my buffer write failure was not a failure at all.  It occurred as an issue because the file I was reading from the USB stock had all F's until several pages into the file.  The data was being pulled from USB drive so my visibility was severely limited.  Optimization required for the stack to fit reduced my ability to accurately see what was happening.  In a single word, "dohhhhh!"  Thanks to all that helped. 
    #7
    Jump to:
    © 2018 APG vNext Commercial Version 4.5