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.

[参考译文] TMS320F28377D:CPU2 为什么恨我? 无法触发 GPIO

Guru**** 2574645 points
Other Parts Discussed in Thread: UNIFLASH

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

https://e2e.ti.com/support/microcontrollers/c2000-microcontrollers-group/c2000/f/c2000-microcontrollers-forum/1573476/tms320f28377d-why-does-cpu2-hate-me-unable-to-fire-a-gpio

器件型号:TMS320F28377D
Thread 中讨论的其他器件:UNIFLASH

工具/软件:

这应该是最基本的问题,但我被砸了。 我希望 CPU2 切换 GPIO44。

在 CPU2 上、我具有:

#include "F28x_Project.h"
#include "F2837xD_device.h"
#include "F2837xD_Gpio.h"

void main(void)
{
InitSysCtrl();

//
// cpu1 will give us this pin: let's toggle one line at a time to watch in debugger
//

GpioDataRegs.GPBSET.bit.GPIO44 = 1;
GpioDataRegs.GPBSET.bit.GPIO44 = 0;
GpioDataRegs.GPBSET.bit.GPIO44 = 1;
GpioDataRegs.GPBSET.bit.GPIO44 = 0;

//
// Or try a simple blink loop with toggle:
//
for(;;)
{
    GpioDataRegs.GPBTOGGLE.bit.GPIO44 = 1;
    DELAY_US(10000); // 10 000 µs = 0.01 s at 200 MHz SYSCLK
}
}

但很明显、我需要先从 CPU1 开始获取该引脚的保持时间、因此可以得到:


#include "F28x_Project.h"
#include "F2837xD_Ipc.h"
#include "F2837xD_device.h"
#include "F2837xD_GlobalPrototypes.h"
#include "F2837xD_Gpio_defines.h"
#include "F2837xD_Ipc_drivers.h"

static void BootCPU2_FromFlash(void)
{
EALLOW;
IpcRegs.IPCBOOTSTS = 0; // clear stale boot status flags
IPCBootCPU2(C1C2_BROM_BOOTMODE_BOOT_FROM_FLASH);
EDIS;
}

void main(void)
{
InitSysCtrl();


EALLOW;
DevCfgRegs.CPU2RESCTL.bit.RESET = 1;   // make sure CPU2 is held in reset
EDIS;

InitGpio();

EALLOW;
GpioCtrlRegs.GPBMUX1.bit.GPIO44 = 0;   // detach from any peripheral
GpioCtrlRegs.GPBDIR.bit.GPIO44 = 1;    // enable for output
GpioDataRegs.GPBSET.bit.GPIO44 = 1;    // turn on just to check scope
GpioCtrlRegs.GPBCSEL2.bit.GPIO44 = 1;  // hand over to CPU2 owns GPIO44
GpioDataRegs.GPBTOGGLE.bit.GPIO44 = 1; // should not toggle
EDIS;

// Basic interrupt/PIE init 
DINT;
InitPieCtrl();
IER = 0x0000;
IFR = 0x0000;
InitPieVectTable();
EINT

// Minimal flash wait state init for CPU1 code
InitFlash();

// Do the boot
BootCPU2_FromFlash();

// CPU1 go idle
for(;;) { asm(" NOP"); }
}

当 CPU1 触发时、我看到 GPIO44 在示波器上上升、一旦 设置了 GPBCSEL2、那么对 GPBTOGGLE 的后续调用不执行任何操作、这是合适的。 然后引导 CPU2 时、我确实会看到 GPI044 降至零、这会引起兴趣(但我猜可以吗?)。 但不管我从 CPU2 内部做什么,我都不能得到 PIN 卡。 我还尝试将 GPBGMUX1 设置为零。

什么是我的缺失?  谢谢。

(如果相关的话,我正在使用编译器 20.4。 使用 CCS 或 Uniflash 加载代码时会出现相同的行为。)

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

    显然,我只是需要发布问题,然后几乎立即我会找到答案:-)

    我的 bug 是/是我将一些较旧的样式代码与一些较新的样式混合在一起。 如果我将 CPU1 代码更改为执行以下操作:

    GPIO_SetupPinMux(44, GPIO_MUX_CPU2, 0);

    GPIO_SetupPinOptions(44, GPIO_OUTPUT, GPIO_PUSHPULL);

    那么一切都很完美。