Jump to content
  • 0

How could I save large amount data in Basys3?


GreatGBL

Question

Hello, I connect a microphone with an ADC, and I want to use Basys3 to collect the ADC output data. The ADC use SPI protocol and I succeeded to communication with them.

My question is that if I run the microphone in 3s, and the ADC has 12bit resolution and 40K sample rate.  At least I have 3*12*40K = 144000 bits data.  it equal to 18000 Byte or 175.78KB.

So how could I save those large amount data into Basys3? use Stack? if it is OK , at least I need 18000 address.......

Link to comment
Share on other sites

3 answers to this question

Recommended Posts

@GreatGBL,

Hmm ... the largest block RAM memory I was able to instantiate on my own Basys3 was 128kB.  Looks like you might need a touch more than that.

The traditional solution would be one or more of 1) compressing your data, or 2) moving the data off of your Basys-3 onto a device that can handle it.  Of those two, my wager is that 1) you rarely need all of those 12 bits, and 2) if you plug the Basys3 to a PC-host computer, the Basys-3 can dump information to its UART port at 4Mbaud (roughly 3.2Mbps, or about 4MB/s).  Although if you actually need to keep the data on the Basys-3, such as for a later play back, then 2) won't be doable.

How about compression?  Let's discuss loss-less compression for a moment.  Suppose we chose to compress everything but the sign bit and the bottom four bits of your sample, so ... 7 bits.  If you could compress these on average to 2-3 bits, you would then just barely fit everything into memory. 

Another approach to compression might be to use some form of automatic gain control, so that you always keep the quiet bits if things are quiet, but not when things are noisy ...?

Dan

Link to comment
Share on other sites

15 minutes ago, D@n said:

@GreatGBL,

Hmm ... the largest block RAM memory I was able to instantiate on my own Basys3 was 128kB.  Looks like you might need a touch more than that.

The traditional solution would be one or more of 1) compressing your data, or 2) moving the data off of your Basys-3 onto a device that can handle it.  Of those two, my wager is that 1) you rarely need all of those 12 bits, and 2) if you plug the Basys3 to a PC-host computer, the Basys-3 can dump information to its UART port at 4Mbaud (roughly 3.2Mbps, or about 4MB/s).  Although if you actually need to keep the data on the Basys-3, such as for a later play back, then 2) won't be doable.

How about compression?  Let's discuss loss-less compression for a moment.  Suppose we chose to compress everything but the sign bit and the bottom four bits of your sample, so ... 7 bits.  If you could compress these on average to 2-3 bits, you would then just barely fit everything into memory. 

Another approach to compression might be to use some form of automatic gain control, so that you always keep the quiet bits if things are quiet, but not when things are noisy ...?

Dan

1

1.png

 

Hello, I found some information in the reference page of Basys3, it looks like there is a 32Mbit capacity RAM on  Basys3.

Then, I am interesting in the UART, how could i use it on Basys3?

Link to comment
Share on other sites

@GreatGBL,

The 32MBit flash is not a RAM at all by any means.  It acts more like a programmable ROM.  I built a controller for it some time ago if you are interested.  You can find it here and more specifically in this verilog file.  I'm still using it, but writing to a flash is an involved process.  It is doable, but you'll want to know what you are up to.  Basically, it requires a couple steps.  First, you must set all the bits to ones in a sector you are interested in.  That's called erasing.  It can be done before you record.  The second step is to set the bits you are interested in to zeros.  That's called programming.  Both tasks are slow, but if I recall correctly, they should be able to keep up with your data rate.  You can find a software controller I use for this task as part of my CMod S6 project (it uses the same controller I used for the Basys).  I tried to make programming as simple as just writing to the memory in order, but ... it's still a little more complicated than that.  Be aware, though: the Flash is shared with any permanent configuration you might have on your device.  So, if you offset your writing by writing into a sector that you aren't otherwise using, you should be okay there.

As for the UART device, have you looked at all at any of the UART examples I posted?  You'll find within the bench/verilator directory several tests that can show you how well the UART works, as well as demonstrating for you a simple interface you might work with.  These include a simple hello world test which simply prints hello world to your terminal on a repeating basis.  This demonstrates a *very* simply interface to a UART driver.  There's also a "speech test" which prints a copy of the Gettysburg address to your terminal (it's a speech test because it recites the speech, not because it speeks).  This demonstrates a much more complex UART driver, such as one might use were you to connect it to a larger bus and/or a CPU.  A third test just echoes what you type into your terminal back to you, and a fourth one waits for you to type a line into your terminal before typing it back to you.  These latter two tests also demonstrate a UART receiver, as well as the transmitter.  You should be able to adjust the baud rate of these examples from their current setting (115,200 Baud) all the way up to the 4MBaud you sound interested in.

Dan

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...