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.
在使用 Hercules TMS570LS04x/03x LaunchPad 调试SCI功能时,发现不能进入接收中断,软件代码基于sluc270a_bq76PL455A-Q1 Example Code修改(下载地址为 www.ti.com/.../sluc270 ), 其中 初始化部分均未修改 连接TI的BQ76PL455芯片(BQ76PL455EVM)进行通讯,发现通过串口发送的命令有返回数值,但是在软件中无法接收数据,无法进入SCI.C中的 void linLowLevelInterrupt(void) 或者void linHighLevelInterrupt(void),同时sys_main.c中初始化中的_enable_IRQ(); 在工程中找不到原型。
而SCI得初始化中都配置了RX引脚
scilinREG->GCR0 = 0U;
scilinREG->GCR0 = 1U;
/** - Disable all interrupts */
scilinREG->CLEARINT = 0xFFFFFFFFU;
scilinREG->CLEARINTLVL = 0xFFFFFFFFU;
/** - global control 1 */
scilinREG->GCR1 = (1U << 25U) /* enable transmit */
| (1U << 24U) /* enable receive */
| (1U << 17U) /* Continue on suspend */
| (1U << 5U) /* internal clock (device has no clock pin) */
| ((1U-1U) << 4U) /* number of stop bits */
| (0U << 3U) /* even parity, otherwise odd */
| (0U << 2U) /* enable parity */
| (1U << 1U); /* asynchronous timing mode */
/** - set baudrate */
scilinREG->BRS = 19U; /* baudrate */
/** - transmission length */
scilinREG->FORMAT = 8U - 1U; /* length */
/** - set SCI pins functional mode */
scilinREG->PIO0 = (1U << 2U) /* tx pin */
| (1U << 1U) /* rx pin */
| (0U); /* clk pin */
/** - set SCI pins default output value */
scilinREG->PIO3 = (1U << 2U) /* tx pin */
| (0U << 1U) /* rx pin */
| (0U); /* clk pin */
/** - set SCI pins output direction */
scilinREG->PIO1 = (1U << 2U) /* tx pin */
| (0U << 1U) /* rx pin */
| (0U); /* clk pin */
/** - set SCI pins open drain enable */
scilinREG->PIO6 = (0U << 2U) /* tx pin */
| (0U << 1U) /* rx pin */
| (0U); /* clk pin */
/** - set SCI pins pullup/pulldown enable */
scilinREG->PIO7 = (0U << 2U) /* tx pin */
| (1U << 1U) /* rx pin */
| (0U); /* clk pin */
/** - set SCI pins pullup/pulldown select */
scilinREG->PIO8 = (1U << 2U) /* tx pin */
| (1U << 1U) /* rx pin */
| (1U); /* clk pin */
/** - set interrupt level */
scilinREG->SETINTLVL = (0U << 26U) /* Framing error */
| (0U << 25U) /* Overrun error */
| (0U << 24U) /* Parity error */
| (0U << 9U) /* Receive */
| (1U << 8U) /* Transmit */
| (0U << 1U) /* Wakeup */
| (0U); /* Break detect */
/** - set interrupt enable */
scilinREG->SETINT = (0U << 26U) /* Framing error */
| (0U << 25U) /* Overrun error */
| (0U << 24U) /* Parity error */
| (1U << 9U) /* Receive */
| (0U << 1U) /* Wakeup */
| (0U); /* Break detect */
/** - initialize global transfer variables */
g_sciTransfer_t.mode = 0U << 8U;
g_sciTransfer_t.tx_length = 0U;
g_sciTransfer_t.rx_length = 0U;
/** - Finaly start SCILIN */
scilinREG->GCR1 |= (1U << 7U);
在PL455.C中调用了以下函数
void sciReceive(sciBASE_t *sci, uint32 length, uint8 * data)
{
/* USER CODE BEGIN (17) */
/* USER CODE END */
if ((sci->SETINT & SCI_RX_INT) == SCI_RX_INT)
{
/* we are in interrupt mode */
/* clear error flags */
sci->FLR = ((uint32) SCI_FE_INT | (uint32) SCI_OE_INT | (uint32) SCI_PE_INT);
g_sciTransfer_t.rx_length = length;
/*SAFETYMCUSW 45 D MR:21.1 <APPROVED> "Valid non NULL input parameters are only allowed in this driver" */
g_sciTransfer_t.rx_data = data;
}
else
{
/*SAFETYMCUSW 30 S MR:12.2,12.3 <APPROVED> "Used for data count in Transmit/Receive polling and Interrupt mode" */
while ((length--) > 0U)
{
/*SAFETYMCUSW 28 D MR:NA <APPROVED> "Potentially infinite loop found - Hardware Status check for execution sequence" */
while ((sci->FLR & SCI_RX_INT) == 0U)
{
} /* Wait */
/*SAFETYMCUSW 45 D MR:21.1 <APPROVED> "Valid non NULL input parameters are only allowed in this driver" */
*data = (uint8)(sci->RD & 0x000000FFU);
/*SAFETYMCUSW 45 D MR:21.1 <APPROVED> "Valid non NULL input parameters are only allowed in this driver" */
*data++;
}
}
/* USER CODE BEGIN (18) */
/* USER CODE END */
}
能够进入 if ((sci->SETINT & SCI_RX_INT) == SCI_RX_INT)这个条件中。
求大家指教!!!!!!
_enable_IRQ(); 在CCS的运行支持库中,工程里面看不到。
你的程序里面修改了哪些部分?可以参考下这个帖子:
http://www.deyisupport.com/question_answer/microcontrollers/hercules/f/70/t/104590.aspx
主要是用HAL code generator重新配置了SCI的中断部分,还有VIM中的中断向量 现在是进不去中断,更不用说sciNotification()这个函数了