器件型号:DK-TM4C129X
工具/软件:Code Composer Studio
你(们)好。
我正在使用 DK-TM4C129X。 对于简单 IO 测试仪、我想在显示屏上写下待测试信号的名称。
因此我定义了信号名称的 const char*数组和一个计数器、该计数器指示正在测试哪个信号。
如果我尝试调试软件、MCU 在 FrameDraw 函数期间崩溃、并卡在 FaultISR 例程中。
当我在 GrStringDrawCentered 函数中将 SIG[计数器]替换为 SIG[8]或 SIG[0]时、它将起作用。 当然、只需打印始终相同的字符串即可。
感谢您的回答
Benjamin
代码开始:
内部
main (空)
{
//开始测试代码
volatile uint32_t ui32Loop;
//char * test ="";
const char* sig []={"FPgaMdprt1v8io[0]}"、
"FpgaMdprt1v8io[1]"、
"FpgaMdprt1v8io[2]、
"FpgaMdprt1v8io[3]、
"FpgaMdprt1v8io[4]"、
"FpgaMdprt1v8io[5]、
"FpgaMdprt1v8io[6]、
"FpgaMdprt1v8io[7]、
"FpgaMdprt1v8io[8]"、
"FpgaMdprt1v8io[9]"、
"FpgaMdprt1v8io[10]"、
"FpgaMdprt1v8io[11]"、
"FpgaTdprt1v8io[0]"、
"FpgaTdprt1v8io[1]"、
"FpgaTdprt1v8io[2]、
"FpgaTdprt1v8io[3]、
"CpldMdprt1v8io[0]"、
"CpldMdprt1v8io[1]"、
"FpgaMdprt1v8io[16]至[22]"、
"FpgaMdprt1v8io[17]至[26]"、
"FpgaMdprt1v8io[18]至[24]"、
"FpgaMdprt1v8io[19]至[25]"、
"FpgaMdprt1v8io[20]至[23]"、
"FpgaMdprt1v8io[21]至[27]"、
"FpgaTdprt1v8io[8]至[12]"、
"FpgaTdprt1v8io[9]至[13]"、
"FpgaTdprt1v8io[10]至[11]"};
uint32_t 端口[]={
GPIO_PORTK_base、
GPIO_Porth_BASE、
GPIO_PORTK_base、
GPIO_Porth_BASE、
GPIO_PORTG_base、
GPIO_Porth_BASE、
GPIO_PORTG_base、
GPIO_Porth_BASE、
GPIO_PORTK_base、
GPIO_PORTC_BASE、
GPIO_PORTK_base、
GPIO_PORTM_BASE、
GPIO_PORTM_BASE、
GPIO_PORTF_BASE、
GPIO_PORTF_BASE、
GPIO_PORTG_base、
GPIO_Porta_base、
GPIO_PORTN_BASE、
GPIO_PORTG_base、
GPIO_Porta_base、
GPIO_PORTM_BASE、
GPIO_PORTN_BASE、
GPIO_PORTP_BASE、
GPIO_PORTQ_BASE、
GPIO_PORTG_base、
GPIO_PORTQ_BASE、
GPIO_PORTG_base};
uint8_t PIN[]={
GPIO_PIN_5、
GPIO_PIN_0、
GPIO_PIN_4、
GPIO_PIN_1、
GPIO_PIN_4、
GPIO_PIN_2、
GPIO_PIN_5、
GPIO_PIN_3、
GPIO_PIN_6、
GPIO_PIN_7、
GPIO_PIN_7、
GPIO_PIN_7、
GPIO_PIN_6、
GPIO_PIN_3、
GPIO_PIN_2、
GPIO_PIN_7、
GPIO_PIN_7、
GPIO_PIN_4、
GPIO_PIN_2、
GPIO_PIN_6、
GPIO_PIN_4、
GPIO_PIN_6、
GPIO_PIN_0、
GPIO_PIN_5、
GPIO_PIN_3、
GPIO_PIN_6、
GPIO_PIN_6};
uint32_t 计数器= 0;
//
//配置器件引脚。
//
//
//启用用于板载 LED 的 GPIO 端口。
//
SysCtlPeripheralEnable (SYSCTL_Periph_GPIOA);
SysCtlPeripheralEnable (SYSCTL_Periph_GPIOC);
SysCtlPeripheralEnable (SYSCTL_Periph_GPIOF);
SysCtlPeripheralEnable (SYSCTL_Periph_GPIOG);
SysCtlPeripheralEnable (SYSCTL_Periph_GPIOH);
SysCtlPeripheralEnable (SYSCTL_Periph_GPIOJ);
SysCtlPeripheralEnable (SYSCTL_Periph_GPIOK);
SysCtlPeripheralEnable (SYSCTL_Periph_GPIOM);
SysCtlPeripheralEnable (SYSCTL_Periph_GPION);
SysCtlPeripheralEnable (SYSCTL_Periph_GPIOP);
SysCtlPeripheralEnable (SYSCTL_Periph_GPIOQ);
//
//检查是否启用了外设访问。
//
while (!SysCtlPeripheralReady (SYSCTL_Periph_GPIOQ))
{
}
for (counter = 0;counter <= 26;counter++)
{
GPIOPinTypeGPIOOutput (port[counter]、PIN[counter]);
}
GPIOPinTypeGPIOInput (GPIO_PORTP_BASE、GPIO_PIN_1);
GPIOPinTypeGPIOOutput (GPIO_PORTJ_BASE、GPIO_PIN_7);
GPIOPinTypeGPIOOutput (GPIO_PORTG_base、GPIO_PIN_0);
//
//永久循环。
//
//--
tContext sContext;
uint32_t ui32SysClock;
PinoutSet();
//
//从 PLL 以120MHz 运行。
//
ui32SysClock = MAP_SysCtlClockFreqSet ((SYSCTL_XTAL_25MHz |
SYSCTL_OSC_MAIN | SYSCTL_USE_PLL |
SYSCTL_CFG_VCO_480)、120000000);
while (1)
{
GPIOPinWrite (GPIO_PORTJ_BASE、GPIO_PIN_7、GPIO_PIN_7);
GPIOPinWrite (GPIO_PORTG_base、GPIO_PIN_0、GPIO_PIN_0);
//
//打开 LED。
//
对于(计数器= 0;计数器<= 26;计数器++)
{
GPIOPinWrite (PORT[计数器]、PIN[计数器]、PIN[计数器]);
btnSelPosEdge();
GPIOPinWrite (端口[计数器]、PIN[计数器]、0x0);
//WriteToDisplay (ui32SysClock、sContext);
Kentec320x240x16_SSD2119Init (ui32SysClock);
GrContextInit (&sContext、&g_sKentec320x240x16_SSD2119);
FrameDraw (&sContext,“测试”);
GrContextFontSet (&sContext、g_psFontCm20);
GrStringDrawCenter(&S Context, SIG[计数器],-1,
GrContextDpyWidthGet (&sContext)/ 2、
(((GrContextDpyHeightGet (&sContext)- 32)/2)+ 24、
0);
//
//刷新任何缓存的绘图操作。
//
格林图(&S);
}