gpt4 book ai didi

memory - 皮质_M4_0 : error occurs in GPIO code in debug mode

转载 作者:行者123 更新时间:2023-12-04 15:35:51 24 4
gpt4 key购买 nike

每当我尝试使用 Code Composer Studio V 9.1.0 调试我的程序时,我都会遇到此错误:

CORTEX_M4_0: Trouble Reading Memory Block at 0x400043fc on Page 0 of Length 0x4: Debug Port error occurred

我使用的是 Texas Instruments TM4C123GXL launchpad,它通过 USB 数据线连接到我的笔记本电脑。我可以成功构建我的程序,但每当我尝试调试我的程序时,错误就会出现。我的程序应该使用 SysTick 中断来连续改变 Elegoo 薄膜开关模块上的电压,以允许程序查看我按下了哪个按钮。我不能 100% 确定我是否已正确初始化 GPIO 输入和输出端口,但错误发生在程序启动并到达我的主循环之前。

这是一些代码和我的错误的截图:

My code

这是一些代码:

void SysTickInit()
{
NVIC_ST_CTRL_R = 0;
NVIC_ST_RELOAD_R = 0x0C3500; // delays for 10ms (800,000 in hex) '0x0C3500' is
// original correct
NVIC_ST_CURRENT_R = 0;
NVIC_ST_CTRL_R = 0x07; // activates the systick clock, interrupts and enables it again.
}

void Delay1ms(uint32_t n)
{
uint32_t volatile time;
while (n)
{
time = 72724 * 2 / 91; // 1msec, tuned at 80 MHz
while (time)
{
time--;
}
n--;
}
}

void SysTick_Handler(void) // this function is suppose to change which port
// outputs voltage and runs every time systick goes
// to zero
{
if (Counter % 4 == 0)
{
Counter++;
GPIO_PORTA_DATA_R &= 0x00; // clears all of port A ( 2-5)
GPIO_PORTA_DATA_R |= 0x04; // activates the voltage for PORT A pin 2
Delay1ms(990);
}
else if (Counter % 4 == 1)
{
Counter++;
GPIO_PORTA_DATA_R &= 0x00; // clears all of port A (2-5)
GPIO_PORTA_DATA_R |= 0x08; // activates voltage for PORT A pin 3
Delay1ms(990);
}
else if (Counter % 4 == 2)
{
Counter++;
GPIO_PORTA_DATA_R &= 0x00; // clears all of port A (2-5)
GPIO_PORTA_DATA_R |= 0x10; // activates voltage for PORT A pin 4
Delay1ms(990);
}
else if (Counter % 4 == 3)
{
Counter++;
GPIO_PORTA_DATA_R &= 0x00; // clears all of port A (2-5)
GPIO_PORTA_DATA_R |= 0x20; // activates voltage for PORT A pin 5
Delay1ms(990);
}
}

void KeyPadInit()
{
SYSCTL_RCGCGPIO_R |= 0x03; // turns on the clock for Port A and Port B
while ((SYSCTL_RCGCGPIO_R) != 0x03) { }; // waits for clock to stabilize

GPIO_PORTA_DIR_R |= 0x3C; // Port A pins 2-5 are outputs (i think)
GPIO_PORTA_DEN_R |= 0x3C; // digitally enables Port A pins 2-5

GPIO_PORTA_DIR_R &= ~0xC0; // makes Port A pin 6 and 7 inputs
GPIO_PORTA_DEN_R |= 0XC0; // makes Port A pin 6 and 7 digitally enabled

GPIO_PORTB_DIR_R &= ~0X03; // makes Port B pin 0 and 1 inputs
GPIO_PORTB_DEN_R |= 0x03; // makes PortB pin 0 and 1 digitally enabled
}

最佳答案

我发现了我的错误发生的原因。我去找我的教授,他有一个定制的设备来检查我在发射台上的引脚是否正常工作。事实证明,我在端口 A 和 B 上使用的一些引脚消耗了太多电流,根据定制设备,这些引脚被破坏了。换句话说,这个错误是因为 IDE 检测到我的某些引脚不再可用。

关于memory - 皮质_M4_0 : error occurs in GPIO code in debug mode,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/59795308/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com