Skip to content

Fatal Errors

Michael Finn Jørgensen edited this page Jun 7, 2023 · 8 revisions

Heap corruption: Hint: MENU_HEAP_SIZE or OPTM_HEAP_SIZE

This error message indicates that the size of your menu in config.vhd has grown beyond the size that can be managed using the current Shell memory layout. You can change this layout in m2m-rom.asm. The error code indicates the heap overrun in words. Use this value as an indication of how to change the Shell memory layout.

SD Card: <any error message>

Most likely, this error has one of these reasons:

  • HDMI back powering problem
  • SD card is not FAT32 formatted
  • SD card has a capacity larger then 32 GB
  • Read / write problem, for example due to a single bad block

SD Cards tend to age. While professional SD card controllers (using the SD Card's so-called "native mode") can handle this topic gracefully most of the time, M2M's SPI-based controller can't. A single bad block does not render the whole SD card unusable. But it can be very annoying for users to run into this problem, for example as soon as they enter a particular folder on their SD card.

The solution for this is as simple as it is sometimes unsatisfactory: Tell your user to backup the contents of the SD card, to re-format it and then restore the contents and if this does not help: Buy a new SD card. There is empiric evidence suggesting that SanDisk and Verbatim SD cards work better than others.

Interpreting the SD Card related error codes

SD Card related error codes are 16-bit hex values split into two bytes XXYY:

If XX is less than EE (238), then XX is an error that happened in the hardware layer of the stack, i.e. in the SD card controller that is implemented in the file M2M/QNICE/vhdl/sd_spi.vhd. Go to the definition of the VHDL subtype t_error_code. The following error codes are what YY in the above-mentioned XXYY error code means. Locate a block called calcDebugOutputs and you will be able to decode the meaning of XX.

In case XX equals EE (238), then the error can have three different sources. Two of them are hardware-related:

a) EE21: A communication problem (which might hint to a logic error) between the sd_spi.vhd module mentioned above and the QNICE adapter for the SD card controller located in M2M/QNICE/vhdl/sdcard.vhd: EE21 means that the system is trying to write to the SD card while there is a pending read or trying to read while there is a pending write.

b) EEFF: A timeout occurred while QNICE's SD card hardware access routines located in M2M/QNICE/monitor/sd_library.asm tried to access the SD card (read or write).

The third source of errors, if XX equals EE, are errors that are happening in the QNICE FAT32 stack. Head to the file M2M/QNICE/monitor/sysdef.asm and locate a section called "FAT32 ERROR CODES". Use this information to decipher YY.

Error Y

Error Z