How can I read/write data Via USB from/to the DSP memory/external sdram in BF547 based board?
Does anyone know what is the memory address in the DSP that the usb driver writes to?
I have branched this to a new thread for greater visibility, as the thread you posted to was a separate topic and already marked as answered.
Please continue the discussion here.
I haven"t found any documantation that instracuts how to port the USB driver to my application.
I want to use the mass storage driver in my application (to use only the SDRAM not harddrive).
What is the memory address in the DSP that the usb driver writes to?
The USB Drivers use a 1D buffer for USB - you will see this defined at the top of the "mass_storage_app.c" source file, as "static ADI_DEV_1D_BUFFER usbBuffer;".
Similarly, in the examples for the BF548 EZ-KIT lite, you will see that "mass_storage_app.c" defines "#define _USE_ONBOARD_PERSISTENT_MEDIA_". As explained in the notes for this definition, you should leave this defined if you are using the NAND, or Hard Disk. If - as is the case with your aim - you want to use a RAM disk, just comment out this definition. You will see throughout the source code where this definition (or lack of) affects the execution of the code, that should give you a clear idea how to achieve this on your own application.
Thanks. I have used the ram disk configuration and I saw the usbBuffer in the DSP memory.
The driver saves the data file that I save in the portable device E at address 0x008cd6 in the SDRAM of the BF548 evaluation board.
Where is the mapping to this address in the code?
My goal is to transfer data via matlab to the DSP memory and back.
Can I use the mass storage device driver for this task? or you suggest another solution?
for uploading data from DSP to PC : Can I change the data in the file saved in the portable device E if I change the data in the DSP SDRAM?
Memory for the 8MB RAM disk is allocated off the heap, which is located in SDRAM0_BANK0. In the Mass Storage example, the ADI_USB_MSD_CMD_SET_MEMORY_SIZE command is used to configure the memory size to 8MB.
From the description you gave, I don't think the Mass Storage device is what you are looking for. It sounds more like you want the Blackfin target to be a device that can transfer data to/from a PC, rather than acting as a Mass Storage Device. You might want to take a look at the Bulk loopback example, which uses a simple PC-side host application to transfer data to/from the target.
As for using Matlab, this might be feasible but we do not provide any such utility. I would suggest you may need to write your own PC-side host application that communicates with Matlab (e.g. via COM), and transfers data to/from the Blackfin target via USB in a similar way to our Bulk loopback example.
As for the mass storage device I saw where in the SDRAM the data in ascii format is located (address 0x008cd6). But if I change the data in the SDRAM and doing refresh in the PC directory the data in the file is not changed. Why is that? What shoud I do in order to change the file in the PC via the DSP memory change?
I have used the hostapp application for downloading data from the loopback example but it is limited application.
Is there any other applicatioin/GUI that can download from DSP memory to a file with the bulk driver example?
Will the bulk driver can work in RT DSP program?
The hostapp - as with the other USB examples - is limited as it is only provided as a simple example to interface with the USB on the Blackfin target. The full source is provided for you to adapt, if you need the assistance of a starting point for your host-side application. I have provided a link to the source in one of your other threads, here:USB driver evaluation SW GUI
I am not sure why your changes are not taking effect in Windows. If the changes are being made to the correct location of the file stored on the file system, I would expect Windows to refresh correctly. Have you tried the other way; editing a file in Windows and observing the changes within Blackfin memory?
Are you able to provide you application, together with details of the steps to reproduce the behaviour?
Thanks for your support.
Please find attached application for BF548 eval and screenshot of the memory
It can be seen that the memory was changed (40bytes copied from address 0x8ff6 to 0x8cd8).
But if you will do refresh to the e drive and open the file you will see that the data is not changed like in the SDRAMmemory. Any advise?
Why if I halt the processor and then run it again I get the item not found when Itry to refresh the E drive.
How and where should I change the driver to use polling instead of interrupts?
I suspect the issue lies with caching, either by the Windows host, or by the Blackfin. I'll ask one of the USB developers to take a look.
Have you got any feedback?
Not yet, unfortunately. I will send a follow-up to the team I have asked to look into this.
The important thing to remember about USB Mass storage devices is that Windows will cache the data. Refreshing the explorer window will not result in any changes to its view of things unless another Windows' process has updated the file system. There is a mechanism defined in the USB MSC protocol for indicating to Windows when the media has been changed, which is not handled in our implementation.
However, I have made some simple modifications to the MSC driver to handle the TEST UNIT READY command. A function pointer is externally referenced in adi_usb_msd_scsi.c,
extern bool (*pf_adi_usb_msd_GetMediaStatus) (void);
which needs to be assigned to a value in your user code. Failure to do so will result in an unresolved symbol. In the attached mass_storage_app.c, I have defined a function that returns false if the media contents are changed. This function is called in response to the TEST UNIT READY command (continuously sent at intervals by Windows). If it returns false the appropriate UNIT ATTENTION Sense Report is generated which will prompt Windows to refresh its view of the media.
The example I have sent, awaits PB1 to be pressed and then creates a small file on the RAMdisk. To do so it has to (a) write a File Allocation Table (FAT) cluster entry, (b) write a directory entry and (c) write the file contents. refreshing Windows' explorer after PB1 is pressed will reveal the file.
Please remember, though that the RAM area exported to Windows' via USB is a fully functional FAT file system, and as such it is not always recommend to change the contents behind the scenes as, in general, Windows may have changes,especially to the FAT that are not flushed to the media. These changes would then be lost upon the UNIT ATTENTION sense report. The other thing to note is that changes on the RAM Disk should ideally be made via the File System Service (FSS) so that the file is properly defined in the File System. However, in order to do so the internal RAM Disk should be replaced with an the RAM Disk PID (lib\src\drivers\pid\ramdisk\adi_ramdisk.c, docs\drivers\pid\ramdisk\adi_ramdisk.pdf) which can be used by both the FSS and the USB MSD. One final point to note is that a lot of gadgets that access the media as well as export it to a host PC, only do so when it is not connected via USB. In this way data integrity is secured at all times.
I want to save data from specific memory locations to a file for post processing of signals.
Retrieving data ...