我尝试通过 HET 代码设置 IRQ、而我做到了这一点、因此勾选了已启用的高级配置模式。
我已在必要的指令中输出 IRQ、并在 main.c 中更改了 HETINTENAS 寄存器。
我的 HET 代码是一个 PWM、在与其匹配时会生成一个 IRQ。 问题是首次生成 IRQ。 之后、我的代码卡在 vim 奇偶校验错误处理程序 funcion 中、不再起作用。
帮助?
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.
我尝试通过 HET 代码设置 IRQ、而我做到了这一点、因此勾选了已启用的高级配置模式。
我已在必要的指令中输出 IRQ、并在 main.c 中更改了 HETINTENAS 寄存器。
我的 HET 代码是一个 PWM、在与其匹配时会生成一个 IRQ。 问题是首次生成 IRQ。 之后、我的代码卡在 vim 奇偶校验错误处理程序 funcion 中、不再起作用。
帮助?
代码卡在 VimParityErrorHandler()中
/** @file sys_main.c * @brief Application main file * @date 11-Dec-2018 * @version 04.07.01 * * This file contains an empty main function, * which can be used for the application. */ /* * Copyright (C) 2009-2018 Texas Instruments Incorporated - www.ti.com * * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the * distribution. * * Neither the name of Texas Instruments Incorporated nor the names of * its contributors may be used to endorse or promote products derived * from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * */ /* USER CODE BEGIN (0) */ /* USER CODE END */ /* Include Files */ #include "sys_common.h" /* USER CODE BEGIN (1) */ #include "rti.h" #include "het.h" #include "gio.h" #include "PWM.h" #include "sys_dma.h" /* USER CODE END */ /** @fn void main(void) * @brief Application main function * @note This function is empty by default. * * This function is called after startup. * The user can use this function to implement the application. */ /* USER CODE BEGIN (2) */ void dmaConfigCtrlPacket(uint32 sadd,uint32 dadd,uint32 dsize); void delay(); uint8 TX_DATA[]={0xaa,0x55}; uint8 RX_DATA[]={0x0,0x0}; void hetNotification(hetBASE_t *het, uint32 offset); g_dmaCTRL g_dmaCTRLPKT; void createTxDummyPacket(uint8_t *packet, uint32_t size); unsigned int phetREG1DOUT8; /* USER CODE END */ int main(void) { /* USER CODE BEGIN (3) */ phetREG1DOUT8 = 0xFFF7B854 + 0x3; // phetREG1DOUT8= &(hetREG2->DOUT) + 3; _enable_IRQ(); dmaReqAssign(DMA_CH0,24); dmaConfigCtrlPacket((uint32)(&TX_DATA),(uint32)(phetREG1DOUT8),2); dmaSetCtrlPacket(DMA_CH0,g_dmaCTRLPKT); dmaSetChEnable(DMA_CH0, DMA_HW); dmaEnableInterrupt(DMA_CH0, BTC); dmaEnable(); /* Enable IRQ - Clear I flag in CPS register */ /* Note: This is usually done by the OS or in an svc dispatcher */ hetInit(); hetREG2->HRSH &= 0xFFFF0000; hetREG2->AND &= 0xFFFF0000; hetREG2->XOR &= 0xFFFF0000; hetREG2->REQENS = (hetREG2->REQENS & 0xFFFFFF00) | ((uint32_t)(1 << DMA_CH6)); hetREG2->REQDS = (hetREG2->REQDS & 0xFF00FF00) | ((uint32_t) (1 << DMA_CH6)); /* Run forever */ /* CORTEX request signal pin - HIGH / LOW */ hetREG2->DIR |= (1 << PIN_HET_0); hetREG2->DIR |= (0 << PIN_HET_4); hetREG2->DIR |= (1 << PIN_HET_6); hetREG1->DIR |= (1 << PIN_HET_24); hetREG1->DIR |= (1 << PIN_HET_25); hetREG1->DIR |= (1 << PIN_HET_26); hetREG1->DIR |= (1 << PIN_HET_27); hetREG1->DIR |= (1 << PIN_HET_28); hetREG1->DIR |= (1 << PIN_HET_29); hetREG1->DIR |= (1 << PIN_HET_30); hetREG1->DIR |= (1 << PIN_HET_31); // hetRAM2->Instruction[pHET_L00_0].Data = (hetRAM2->Instruction[pHET_L00_0].Data & 0x0000007F) | ((uint32_t) 0 << 7); hetRAM2->Instruction[pHET_L06_0].Control |= ((uint32_t) 0x1 << 27); // gen request hetRAM2->Instruction[pHET_L09_0].Data = (hetRAM2->Instruction[pHET_L09_0].Data & 0x0000007F) | ((uint32_t) 24 << 7); //number of bytes hetRAM2->Instruction[pHET_L09_0].Control |= ((uint32_t) 0x1 << 0); //IRQ ON hetREG2->INTENAS |= (1<<pHET_L09_0); while(1) { delay(); hetRAM2->Instruction[pHET_L00_0].Data = (hetRAM2->Instruction[pHET_L00_0].Data & 0x0000007F) | ((uint32_t) 0 << 7); } /* USER CODE END */ return 0; } /* USER CODE BEGIN (4) */ void dmaConfigCtrlPacket(uint32 sadd,uint32 dadd,uint32 dsize) { g_dmaCTRLPKT.SADD = sadd; /* source address */ g_dmaCTRLPKT.DADD = dadd; /* destination address */ g_dmaCTRLPKT.CHCTRL = 0; /* channel control */ g_dmaCTRLPKT.FRCNT = dsize; /* frame count */ g_dmaCTRLPKT.ELCNT = 1; /* element count */ g_dmaCTRLPKT.ELDOFFSET = 4; /* element destination offset */ g_dmaCTRLPKT.ELSOFFSET = 0; /* element destination offset */ g_dmaCTRLPKT.FRDOFFSET = 0; /* frame destination offset */ g_dmaCTRLPKT.FRSOFFSET = 0; /* frame destination offset */ g_dmaCTRLPKT.PORTASGN = 4; /* port b */ g_dmaCTRLPKT.RDSIZE = ACCESS_8_BIT; /* read size */ g_dmaCTRLPKT.WRSIZE = ACCESS_8_BIT; /* write size */ g_dmaCTRLPKT.TTYPE = FRAME_TRANSFER ; /* transfer type */ g_dmaCTRLPKT.ADDMODERD = ADDR_INC1; /* address mode read */ g_dmaCTRLPKT.ADDMODEWR = ADDR_OFFSET; /* address mode write */ g_dmaCTRLPKT.AUTOINIT = AUTOINIT_ON; /* autoinit */ } void delay() { int i=0; for(i=0;i<500;i++) { asm(" nop "); } } void hetNotification(hetBASE_t *het, uint32 offset) { hetREG1 -> DOUT = 0x0; } void createTxDummyPacket(uint8_t *packet, uint32_t size) { uint32_t i = 0; for(i = 0; i < size; i++) { packet[i] = (i % 256); } } /* USER CODE END */
下面的代码是系统中的 main.c 文件。
谢谢!
尊敬的 Nuno:
您可以检查以下主题吗、它可能对您的问题有所帮助:
(+) TMS570LS1114:,ECAP IRQ 无法再次进入。 -基于 Arm 的微控制器论坛-基于 Arm 的微控制器- TI E2E 支持论坛
--
谢谢。此致、
Jagadish。
1.禁用奇偶校验
disableParity();
2.禁用中断。
_disable_interrupt_();
3、使用硬件初始化机制来初始化 VIM RAM
memoryInit ((UINT32)(( UINT32)((UINT32) 1U << 2U));/* VIM RAM */
4.运行 VIM 奇偶校验
vimParityCheck();
5.自检后、请将 VIM RAM 中翻转的位恢复为原来的状态
应在 vimParityCheck()中完成;