This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

sd card i/o hang - beaglebone, starterware, ccs

i have an application which uses both lwip and fatfs/sd card.

when reading the first page requested in httpd, the app hangs in HSMMCSDCardStatusGet

the stack looks like:

...

fs_open
f_open
move_window
disk_read
MMCSDReadCmdSend
MMCSDCmd Send
HSMMCSDCmdSend
HSMMCSDCardStatusGet

the hang is a while on either command complete or a timeout.

So I think I am missing an interrupt...but not sure what to look at next...

 

  • Hi,

    Referance implementation for the same use case is present in Beaglebone Demo example.

    Please refer the same it might help you.

    Reagrds,

    Ramesh D

  • I think the big difference I see between "demo" and my application is that httpd reads in memory data for the files in demo.

    In my application httpd is reading data from the fat/fs-sd/card directly when a page is requested -- that is when the hang occurs.

    If fact if I force my application to read in memory data for the file requested, then it works ok as well.

    I suspect that it is a problem between the httpd support and the fat/fs-sd/card support;

    interrupt priorities, masking....

  • Companion call stack:

    ws-sensors [Code Composer Studio - Device Debugging] 
     Texas Instruments XDS100v2 USB Emulator_0/M3_wakeupSS_0 (Disconnected : Unknown) 
     Texas Instruments XDS100v2 USB Emulator_0/CortxA8 (Suspended) 
      HSMMCSDCmdStatusGet(struct _mmcsdCtrlInfo *)() at hs_mmcsd_rw.c:157 0x80091FB4  
      HSMMCSDCmdSend(struct _mmcsdCtrlInfo *, struct _mmcsdCmd *)() at hs_mmcsdlib.c:211 0x80096368  
      MMCSDCmdSend(struct _mmcsdCtrlInfo *, struct _mmcsdCmd *)() at mmcsd_proto.c:80 0x800905E0  
      MMCSDReadCmdSend(struct _mmcsdCtrlInfo *, void *, unsigned int, unsigned int)() at mmcsd_proto.c:702 0x80091230  
      disk_read(unsigned char, unsigned char *, unsigned int, unsigned char)() at fat_mmcsd.c:137 0x80097950  
      move_window(struct _FATFS *, unsigned int)() at ff.c:87 0x800898A0  
      trace_path(struct _DIR *, unsigned char *, unsigned char *, unsigned char * *)() at ff.c:513 0x8008A718  
      f_open(struct _FIL *, unsigned char *, unsigned char)() at ff.c:823 0x8008B19C  
      fs_open_custom(struct fs_file *, unsigned char *)() at fs_custom.c:161 0x800944E0  
      fs_open(unsigned char *)() at fs.c:116 0x8008E664  
      http_find_file(struct http_state *, unsigned char *, int)() at httpd_io.c:1,794 0x8008F264  
      http_parse_request(struct pbuf * *, struct http_state *, struct tcp_pcb *)() at httpd_io.c:1,676 0x8008F044  
      http_recv(void *, struct tcp_pcb *, struct pbuf *, char)() at httpd_io.c:2,017 0x8008F5B4  
      tcp_input(struct pbuf *, struct netif *)() at tcp_in.c:362 0x80080330  
      ip_input(struct pbuf *, struct netif *)() at ip.c:506 0x80086050  
      ethernet_input(struct pbuf *, struct netif *)() at etharp.c:1,284 0x80087A38  
      cpswif_rx_inthandler(unsigned int, struct netif *)() at cpswif.c:1,121 0x80088D18  
      lwIPRxIntHandler(unsigned int)() at lwiplib.c:320 0x8008963C  
      CPSWCore0RxIsr() at enet.c:231 0x8009727C  
      0x80098BD0  (no symbols are defined for 0x80098BD0) 
     Texas Instruments XDS100v2 USB Emulator_0/PRU_0 (Disconnected : Unknown) 
     Texas Instruments XDS100v2 USB Emulator_0/PRU_1 (Disconnected : Unknown)

  • It turns out this problem was one of interrupt priorities.

    From the Starterware User's Guide: Note : StarterWare implements only Prioritized IRQ Handler. However, if prioritization is not desired, all interrupts can be assigned the same priority level. For example, if all interrupts in an application are assigned priority level 0, no IRQ preemption will occur.

    So I left the EDMA priority at 0; set the MMCSD interrupt at 4 and the 3PGSW TX and RX at 8.