- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
updated 7th november - change title from BeMicro SDK - how to access SD card to
bemicro sdk - how to make the web server run from epcs memoryHi All The reference board I am using is the.... BeMicro SDK bemicro sdk (http://www.arrownac.com/solutions/bemicro-sdk/) or bemicro sdk (http://www.altera.com/b/bemicro-sdk.html) Its supposed to be a SDK (software development kit) but does not provide working / documented examples to use with Ethernet or the uSD Card. strange for a sdk kit? :( Anyway, I want to test the performance of HTTP downloads etc using the ucos and the iniche stack. I downloaded the material "BeMicro SDK Lab Materials v1.22" from the above web site. In the NOIS II development environment there is an option to create a simple web server, its actually for a different development kit. It does not compile, you have to comment out accesses to flash memory in the file network_utilities.c as follows:-#if 0 /* RLF comment out flash accesses as no memory */ /* Write the MAC address to flash */ flash_handle = alt_flash_open_dev(EXT_FLASH_NAME); if (flash_handle) { alt_write_flash(flash_handle, last_flash_sector_offset, flash_content, 32); alt_flash_close_dev(flash_handle); error = 0; } # endif .....and.................... #if 0 /* RLF comment out flash accesses as no memory */ /* Get the flash sector with the MAC address. */ error = FindLastFlashSectorOffset(&last_flash_sector_offset); if (!error) last_flash_sector = EXT_FLASH_BASE + last_flash_sector_offset; /* This last_flash_sector region of flash is examined to see if * valid network settings are present, indicated by a signature of 0x00005afe at * the first address of the last flash sector. This hex value is chosen as the * signature since it looks like the english word "SAFE", meaning that it is * safe to use these network address values. */ if (!error) { signature = IORD_32DIRECT(last_flash_sector, 0); if (signature != 0x00005afe) { error = generate_and_store_mac_addr(); } } # endif .....and.................... /* RLF comment out accesse and hardcode teh mac address */ /* mac_addr[0] = IORD_8DIRECT(last_flash_sector, 4); mac_addr[1] = IORD_8DIRECT(last_flash_sector, 5); mac_addr[2] = IORD_8DIRECT(last_flash_sector, 6); mac_addr[3] = IORD_8DIRECT(last_flash_sector, 7); mac_addr[4] = IORD_8DIRECT(last_flash_sector, 8); mac_addr[5] = IORD_8DIRECT(last_flash_sector, 9); */ /* RLF Modded as example from mobile DDR stack */ /* Hard code MAC address here $$ */ mac_addr[0] = 0x00; mac_addr[1] = 0x15; mac_addr[2] = 0x17; mac_addr[3] = 0x26; mac_addr[4] = 0x63; mac_addr[5] = 0xf8; At first it would not run.... In the BSP make sure the following is set sys_clk_timer is set to sys_timer timestamp_timer is set to high_res_timer The development board now starts up, ipaddress allocated from the DNS server okay etc. Accessing the web server generates the following error message:- "can't find the requested file file. have you programmed the flash filing system into flash?"
On further reading its because the webpages which are stored in ro_zipfs.zip which should be programmed to flash. However this board does not have flash... (apart from configuration EPROM) As the board has 64Mbytes of DDR ram and the program is running from DDR ram, could I load this into RAM ???? (I could find no way) If anyone knows how to do this with the tools supplied with the SDK board please let me know?? Okay...I could use the uSD card slot to store web pages.... But the ip belongs to slscorp (http://www.slscorp.com/ip-cores/memory/sd-host-controller.html), no HAL driver is provided so no way to access the uSD card slot. If I have missed something please let me know. I'm a software developer, I don't want to or know how to change the reference hardware design (FPGA), all the bits are there so I should be able to use it. Any help much appreciated
- Tags:
- If
Link Copied
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
If you don't mind slow access to SD card, you can use SPI bus.
Also, it's not HAL, but you can see a bit of SD card access demo by using this http://www.alterawiki.com/wiki/linux_on_a_bemicro_sdk This is uClinux demo, but has SD card access in it. Also, this example is using SPI bus interface to read/write to the SD card.- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Thanks nekojiru
I already know about the linux port and have tried it...but I can not use linux for my application.... I'm looking at ucosii for the operating system.... From slscorp (http://www.slscorp.com/ip-cores/memory/sd-host-controller.html) I can get an evaluation....I assume that all I need is the driver as the controller is built into the hardware design- Software Drivers
- Custom HAL Driver for accessing SD Card (object code)
- Nios II Sample Applications
- FAT (16/32) File System (RockBox)
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
"from slscorp (http://www.slscorp.com/ip-cores/memory/sd-host-controller.html) i can get an evaluation....i assume that all i need is the driver as the controller is built into the hardware design"
not true, the reference configuration does not contain sd controller... So in order to get access to the SD card, you have to update the FPGA design....licence a trial of the mobile DDR controller and licence a trial of slscorp SD controller, place that in the design or use SPI bus as in the linux example above). :(
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I have given up on using the uSD Card slot... I have managed to get the web server running from EPCS memory, the guide is as follows:-
1) update the simple web server as in the first post, source code and bsp, make sure it runs2) go to the bsp editor, software packages….. change the following:- ro_zipfs_base: to 0xa003800 (which is the base address of ecps memory) and make sure :- ro_zipfs_offset: is 0x100000 (offset to where we will program the flash pages) (reference attachment)
3) generate the bsp 4) the code (ro_zipfs.c) for extracting web pages from memory mapped parallel flash will not work with epcs serial flash, this has to be modified:-
reference attached zip file,altera_ro_zipfs.c.zip,which contains the original Altera file and a corrected version of DrinkFish file Replace the original for the corrected one, reference this post for additional details http://www.alteraforum.com/forum/showthread.php?p=132498#post132498 The following commands are run using the noisII command shell 5) Convert the webpages (ro_zipfs.zip) to an S record file with an offset of 0x100000, use the following command bin2flash --location=0x100000 --input=ro_zipfs.zip --output=ro_zipfs.flash 6) To program the web-server pages to the serial epcs memory use the following command nios2-flash-programmer --epcs --base=0xa003800 ro_zipfs.flash (note:- it will be programmed at the offset specified in 5, in this case in the middle of epcs memory and does not affect the fpga configuration section)Using cable "USB-Blaster [USB-0]", device 1, instance 0x00 Resetting and pausing target processor: OK Checksummed/read 26kB in 0.6s Erased 64kB in 0.6s (106.6kB/s) Programmed 39KB +25KB in 0.6s (106.6KB/s) Did not attempt to verify device contents Leaving target processor paused 6a) Additional Info - You can read the whole contents from the epcs memory by running the following command:- nios2-flash-programmer --epcs --base=0xa003800 --read=epcs_memory_contents.srec --read-bytes=0,0x200000Using cable "USB-Blaster [USB-0]", device 1, instance 0x00 Resetting and pausing target processor: OK Read 2048KB in 49.7s (41.2KB/s) Writing EPCS contents to current.srec Leaving target processor paused 6b) Additional Info - To visually see the contents of this file (i.e. in a binary format) can be done by using the s record import function in “hexworksshop” (remember to re name the file epcs_memory_contents.srec to epcs_memory_contents.srec .mot i.e. mot extension) [/INDENT]7) First Clean and Compile BSP, then Clean and Compile the application That’s it...
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Small update.... The server should now be up and running...
Remote configuration does not work....very minor changes have to be made to index.html in ro_zipfs.zip and are as follows:- --- Quote Start --- epcs_controller needs to be renamed epcs_flash_controller Change the following :- from…….. <select name="flash_device"> <option>ext_flash</option> <option>epcs_controller</option> </select> to…….. <select name="flash_device"> <!-- <option>ext_flash</option> As we have no external flash, comment this option out--> <option>epcs_flash_controller</option> </select> --- Quote End --- Re program as described in 5 & 6 above Now that the web pages have been corrected....you can... (a) Re-program new web pages using the resultant file from section (5) in the above post OR.. (b) Re-program the whole ecps memory by using the resultant file from section (6a) in the above post ETC- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Further to my knowledge, index.html has nothing to do with the type of memory or memory name. I am talking about this webserver example http://www.alterawiki.com/wiki/web_server_with_ajax_progress_bar
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
How can I test the BeMicro once I have flashed it? Do I need a hub and what ip do I type in internet explorer? Is it 192.168.1.234?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Yes, you need a switch to access the web server.
Regarding the IP address, you can define it in the header file (webserver.h)- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
The IP address is displayed in the nios II output window..
By default the software tries to find a dhcp server to allocate it an address, however this can be fixed by turning off dhcp. I believe the output window contains all this info- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I must be doing something wrong. I cannot seem to get the breakpoints to work. I see this in the Console:
Using cable "USB-Blaster [USB-1]", device 1, instance 0x00 Pausing target processor: OK Reading System ID at address 0x080002A8: ID value verified Timestamp value was not verified: value was not specified Listening on port 10249 for connection from GDB: 59saccepted <<< there 3 boxes between 59s and accepted I pause the execution and see this in the stack: BeMicroSDK [Nios II Hardware] Altera CDI GDB Debugger (1/17/12 7:52 AM) (Suspended) Thread [1] (Suspended: Signal 'SIGTRAP' received. Description: Trace/breakpoint trap.) 6 alt_find_file() alt_find_file.c:74 0x0403bdb0 5 alt_flash_open_dev() alt_flash_dev.c:55 0x0401534c 4 read_half_word_inc() altera_ro_zipfs.c:120 0x040219d0 3 check_file_header() altera_ro_zipfs.c:138 0x04021a2c 2 check_file_header() altera_ro_zipfs.c:160 0x04021a80 1 find_file_entry_by_name() altera_ro_zipfs.c:342 0x04021da4 <terminated, exit value: 0>nios2-download (1/17/12 7:52 AM) nios2-download (1/17/12 7:52 AM) nios2-elf-gdb (1/17/12 7:52 AM) Why can't I break at alt_main? Why don't the breakpoints work? There must be a switch I missed.- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
The SD card can be accessed through a standard SPI port.
The pins map as: SD_CLK - CLK SD_DAT0 - MISO SD_DAT3 - CS SD_CMD - MOSI Leave SD_DAT1 and SD_DAT2 disconnected. They will pulled high.- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
If anyone is interested in the SD Card driver, you can use a SPI port and FatFS software on the web. Some slight modificatin was needed for diskio.c.
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page