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.

[参考译文] CCS/DK-TM4C129X:无法将 char*数组的成员写入到 Display

Guru**** 2478765 points


请注意,本文内容源自机器翻译,可能存在语法或其它翻译错误,仅供参考。如需获取准确内容,请参阅链接中的英语原文或自行翻译。

https://e2e.ti.com/support/microcontrollers/arm-based-microcontrollers-group/arm-based-microcontrollers/f/arm-based-microcontrollers-forum/689227/ccs-dk-tm4c129x-not-able-to-write-members-of-a-char-array-to-the-display

器件型号: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);

       }

  • 请注意,本文内容源自机器翻译,可能存在语法或其它翻译错误,仅供参考。如需获取准确内容,请参阅链接中的英语原文或自行翻译。

    您好 Benjamin、

    如果您要执行故障 ISR、那么您和我都需要更多信息来进一步调试。 以下文档介绍了如何找到触发 FaultISR 的原因的更多详细信息、您能否查看并分享您的系统 FaultISR 的原因? 链接: http://www.ti.com/lit/an/spma043/spma043.pdf

  • 请注意,本文内容源自机器翻译,可能存在语法或其它翻译错误,仅供参考。如需获取准确内容,请参阅链接中的英语原文或自行翻译。

    您好 Ralph

    感谢您的快速回复。

    通过查看我发现的寄存器、在 NVIC_FAULT_STAT 寄存器中、BSTKE 和 IMPRE 位被设置为1。

    NVIC_FAULT_ADDR 的值为11100000000011101101111000

    我希望这将对您有所帮助。

    我仍在阅读文档、如果我发现其他内容、我将会给您写信。

    大家好

    Benjamin

  • 请注意,本文内容源自机器翻译,可能存在语法或其它翻译错误,仅供参考。如需获取准确内容,请参阅链接中的英语原文或自行翻译。
    您好 Benjamin、

    那么故障地址是0xE000EDF8十六进制地址? (十六进制地址对我们来说比二进制地址有用得多)。

    我第一次基于正在设置的 BSTKE 位怀疑是、您可能没有足够的堆栈空间保留、从而导致堆栈溢出。 您能否尝试增加堆栈并查看其是否解决了问题?
  • 请注意,本文内容源自机器翻译,可能存在语法或其它翻译错误,仅供参考。如需获取准确内容,请参阅链接中的英语原文或自行翻译。

    您好 Ralph

    非常感谢。 我用较短的数组尝试了它、可以验证它是否是堆栈溢出。 因此,我将 const char*数组定义为全局 const,而不是主例程中的 const。 现在它运行得很好。

    大家好

    Benjamin