Tiva-c TM4C123上的FaultISR中断

时间:2018-11-17 08:46:24

标签: c arm fault code-composer

我有一个简单的问题,我的程序被困在故障ISR中,

下面是我的代码,被困在故障ISR

int writeProgMemoryBlock(const unsigned char *data, uint16_t dataSize, uint8_t bank, uint8_t address, int verify) {
    //return writeMemoryBlock(data, dataSize, bank, address, verify, 1);
        setMemoryBank(bank,0,0);
        setMemoryStartAddress(address);
        uint8_t chunkSize;
        uint8_t *verifyBuffer;
        uint8_t *progBuffer;
        uint16_t i;
        uint8_t j;
        if (verify) verifyBuffer = (uint8_t *)malloc(MPU6050_DMP_MEMORY_CHUNK_SIZE);
        if (1) progBuffer = (uint8_t *)malloc(MPU6050_DMP_MEMORY_CHUNK_SIZE);
        for (i = 0; i < dataSize;) {
            // determine correct chunk size according to bank position and data size
            chunkSize = MPU6050_DMP_MEMORY_CHUNK_SIZE;

            // make sure we don't go past the data size
            if (i + chunkSize > dataSize)
                chunkSize = dataSize - i;

            // make sure this chunk doesn't go past the bank boundary (256 bytes)
            if (chunkSize > 256 - address)
                chunkSize = 256 - address;

            if (1) {
                // write the chunk of data as specified
                for (j = 0; j < chunkSize; j++) progBuffer[j] = pgm_read_byte(data + i + j);
            } else {
                // write the chunk of data as specified
                progBuffer = (uint8_t *)data + i;
            }

             for (i = 0; 0 < chunkSize; i++){
                 writeByte(devAddr, MPU6050_RA_MEM_R_W, progBuffer[i]);
             }




            // verify data if needed
            if (verify && verifyBuffer) {
                setMemoryBank(bank,0,0);
                setMemoryStartAddress(address);
                readBytes(devAddr, MPU6050_RA_MEM_R_W, chunkSize, verifyBuffer);
                if (memcmp(progBuffer, verifyBuffer, chunkSize) != 0) {

                    free(verifyBuffer);
                    if (1) free(progBuffer);
                    return false; // uh oh.
                }
            }

            // increase byte index by [chunkSize]
            i += chunkSize;

            // uint8_t automatically wraps to 0 at 256
            address += chunkSize;

            // if we aren't done, update bank (if necessary) and address
            if (i < dataSize) {
                if (address == 0) bank++;
                setMemoryBank(bank,0,0);
                setMemoryStartAddress(address);
            }
        }
        if (verify) free(verifyBuffer);
        if (1) free(progBuffer);
        return true;
} 

当我尝试调试进入此功能时,它跳入FaultISR功能。

如何找出问题的原因和解决方案?

我将代码编写器工作室与TM4C123一起使用。我正在尝试从MPU6050读取四元数值。我完成了代码,但无法完成项目。

This is my debugging video

预先感谢

0 个答案:

没有答案