Forum - MCS Electronics

 

FAQFAQ SearchSearch RegisterRegister Log inLog in

Copy data from SD-card to XRAM

 
Post new topic   Reply to topic    www.mcselec.com Forum Index -> AVR-DOS
View previous topic :: View next topic  
Author Message
Mrshilov

Bascom LCD Guru



Joined: 24 Jan 2009
Posts: 314
Location: Russia

russia.gif
PostPosted: Wed Oct 04, 2017 8:23 am    Post subject: Copy data from SD-card to XRAM Reply with quote

I need to load content of file (768000 bytes) from SD-card to XRAM memory array. Bload don't work with XRAM. Get has restriction of 64k. So this string:
Code:
Get #10 , X(1) , , 768000

don't work properly with >64k array index and length of data.
I use this way: load data portion to XRAM 48000 bytes buffer and next copy from buffer to destination XRAM position:
Code:
      Temp_dword = 48001
      For Temp_word = 1 To 16
         Get #10 , X(1) , , 48000                           ' Copy 48kb from SD to buffer
         For Word_count = 1 To 48000
            X(temp_dword) = X(word_count)                   ' Copy from buffer to destination
            Incr Temp_dword
         Next Word_count
      Next Temp_word

It works, but slow, because of double unwanted writings. 76800 bytes loads with about 7 seconds. (Xmega128A1U, 48MHz, 16Mb SDRAM - 3port bus, BASCOM 2080)

Is where a faster way to load big data from SD-card directly to XRAM?
Back to top
View user's profile
enniom

Bascom Member



Joined: 20 Oct 2009
Posts: 537

PostPosted: Tue Oct 24, 2017 11:20 pm    Post subject: Reply with quote

An idea to consider:

Code:
DIM A1(48000) as Byte, A2(48000) as Byte, ... , An(48000) as Byte   'Create Back-to-Back XRAM arrays

Get #10, A1(1), , 48000
Get #10, A2(1), , 48000

'....

Get #10, An(1), , 48000
 


E
Back to top
View user's profile
Mrshilov

Bascom LCD Guru



Joined: 24 Jan 2009
Posts: 314
Location: Russia

russia.gif
PostPosted: Wed Oct 25, 2017 1:37 pm    Post subject: Reply with quote

No, it's not works. XRAM placed upper internal RAM (+16384), so real address of A1(1) is 16384, and A1(48000) - 64384. The next array A2(48000) is upper 64k, so GET function not working properly. Because of it I use 48k size buffer and not 64k.
Back to top
View user's profile
enniom

Bascom Member



Joined: 20 Oct 2009
Posts: 537

PostPosted: Sun Oct 29, 2017 11:34 am    Post subject: Reply with quote

One more idea .... I cannot test as I do not have your hardware setup ...

From Help:
Quote:
Dim var AS [XRAM/SRAM/ERAM]type [AT location/variable] [OVERLAY]

Dim x as Long at &H60 'long uses 60,61,62 and 63 hex of SRAM


Code:
DIM A1(&H10000) As XRAM Byte at &H4000 , A2(&H10000) As XRAM Byte At &H14000, ... , An(&H10000) As XRAM Byte At &Hn4000   'Create Back-to-Back XRAM arrays

Get #10, A1(1), , &H10000        'Please check this - it may need to be &HFFFF
Get #10, A2(1), , &H10000        '(or &HFFFF)

'....

Get #10, An(1), , &H10000        '(or &HFFFF)
 


If this does not work, then it must be that the BLOAD and GET commands are limited to SRAM variables.

We could look at changing the library code such that the BLOAD memory pointer can recognize XRAM? Maybe Josef could help here.

E
Back to top
View user's profile
mmarlette

Bascom Member



Joined: 30 Nov 2007
Posts: 311
Location: Delano, MN

usa.gif
PostPosted: Mon Feb 19, 2018 7:53 pm    Post subject: Reply with quote

Any update on this?
Back to top
View user's profile
Display posts from previous:   
Post new topic   Reply to topic    www.mcselec.com Forum Index -> AVR-DOS All times are GMT + 1 Hour
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You cannot download files in this forum