每当我试图使用CodeComposerStudioV9.1.0调试我的程序时,我就会出现这个错误:
CORTEX_M4_0:在0x400043fc处读取0x400043fc长度0x4页内存块的问题:发生调试端口错误
我使用的是德州仪器的TM4C123GXL发射台,它通过USB电缆连接到我的笔记本电脑。我可以成功地构建我的程序,但是每当我尝试调试我的程序时,错误就会出现。我的程序应该使用SysTick中断来不断地改变Elegoo膜开关模块上的电压,以允许程序查看我按的是哪个按钮。我不能100%确定我是否正确地初始化了GPIO输入和输出端口,但是这些错误发生在程序甚至启动并到达我的主循环之前。
下面是一些代码和我的错误的截图:

以下是一些代码:
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
}发布于 2020-02-05 23:54:58
我发现了我的错误发生的原因。我去找我的教授,他有一个定制的设备来检查我的发射台上的引脚是否正常工作。事实证明,我在A和B端口上使用的一些引脚流太大,根据定制的设备,后来就崩溃了。换句话说,这个错误的出现是因为IDE检测到我的一些引脚不再工作了。
发布于 2021-10-19 13:11:56
在我的例子中,我不得不禁用GPIOHBCTL寄存器中的AHB (高级高性能总线)来读取GPIO_PORTx寄存器。如果要在激活AHB时读取寄存器,则必须读取GPIO_PORTx_AHB寄存器。
当AHB被激活时访问GPIO_PORTA_AHB寄存器-它可以工作

激活时对GPIO_PORTA寄存器的访问--失败

发布于 2022-08-27 04:24:17
解决方案是使用RCC部分使时钟进入外围设备
https://stackoverflow.com/questions/59795308
复制相似问题