Skip to content

Transferring lots of data to nRF can cause crash #2318

@jepler

Description

@jepler

To trigger, I run dd if=/dev/zero bs=512 count=200 of=/media/jepler/CIRCUITPY/zero.

With a debug build, I can capture this traceback:

Breakpoint 4, reset_into_safe_mode (reason=reason@entry=GC_ALLOC_OUTSIDE_VM)
    at ../../supervisor/shared/safe_mode.c:84
84	void __attribute__((noinline,)) reset_into_safe_mode(safe_mode_t reason) {
(gdb) where
#0  reset_into_safe_mode (reason=reason@entry=GC_ALLOC_OUTSIDE_VM)
    at ../../supervisor/shared/safe_mode.c:84
#1  0x00027dc4 in gc_alloc (n_bytes=n_bytes@entry=64, 
    has_finaliser=has_finaliser@entry=false, long_lived=<optimized out>)
    at ../../py/gc.c:489
#2  0x000274ec in m_malloc_maybe (num_bytes=num_bytes@entry=64, 
    long_lived=long_lived@entry=false) at ../../py/malloc.c:95
#3  0x00047f86 in allocate_ram_cache ()
    at ../../supervisor/shared/external_flash/external_flash.c:327
#4  0x000482f4 in external_flash_write_block (
    data=data@entry=0x200047e4 <_mscd_buf> "", block=block@entry=203)
    at ../../supervisor/shared/external_flash/external_flash.c:518
#5  0x0004839e in supervisor_flash_write_blocks (
    src=0x200047e4 <_mscd_buf> "", block_num=203, num_blocks=2)
    at ../../supervisor/shared/external_flash/external_flash.c:554
#6  0x00043c9a in flash_write_blocks (src=<optimized out>, 
    block_num=<optimized out>, num_blocks=<optimized out>)
    at ../../supervisor/shared/flash.c:121
#7  0x00042bb4 in disk_write (pdrv=pdrv@entry=0x200044e4 <_internal_vfs>, 
    buff=buff@entry=0x200047e4 <_mscd_buf> "", sector=sector@entry=204, 
    count=count@entry=2) at ../../extmod/vfs_fat_diskio.c:120
#8  0x0004ad58 in tud_msc_write10_cb (lun=<optimized out>, lba=204, 
    offset=<optimized out>, buffer=buffer@entry=0x200047e4 <_mscd_buf> "", 
    bufsize=bufsize@entry=1024)
    at ../../supervisor/shared/usb/usb_msc_flash.c:140
#9  0x00049b26 in mscd_xfer_cb (rhport=<optimized out>, 
    ep_addr=<optimized out>, event=<optimized out>, xferred_bytes=1024)
    at ../../lib/tinyusb/src/class/msc/msc_device.c:474
#10 0x0004920a in tud_task () at ../../lib/tinyusb/src/device/usbd.c:330
#11 0x0004ac3e in usb_background () at ../../supervisor/shared/usb/usb.c:79
#12 0x0004b098 in run_background_tasks () at background.c:61
#13 0x0005acea in common_hal_neopixel_write (
    digitalinout=digitalinout@entry=0x20004774 <status_neopixel>, 
    pixels=pixels@entry=0x2000477c <status_neopixel_color> "\v", 
    numBytes=numBytes@entry=3) at common-hal/neopixel_write/__init__.c:203
#14 0x00043de4 in clear_temp_status ()
    at ../../supervisor/shared/rgb_led_status.c:300
#15 0x00047f1e in spi_flash_flush_keep_cache (
    keep_cache=keep_cache@entry=false)
    at ../../supervisor/shared/external_flash/external_flash.c:444
#16 0x00048190 in supervisor_flash_release_cache ()
    at ../../supervisor/shared/external_flash/external_flash.c:455
#17 0x00043aee in filesystem_flush ()
    at ../../supervisor/shared/filesystem.c:127
#18 0x000430fa in start_mp (heap=heap@entry=0x200063c0 <allocations+16>)
    at ../../main.c:116
#19 0x000432aa in run_code_py (safe_mode=safe_mode@entry=NO_SAFE_MODE)
    at ../../main.c:240
#20 0x000435a2 in main () at ../../main.c:464

At this point, the device disconnects from USB and the indicator blinks yellow until reset.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions