主题中讨论的其他器件:C2000WARE
我正在努力将项目转换为使用此器件上的两个内核、但在使 GPIO 从内核2工作时遇到了问题。
我的引脚设置基本如下:
GPIO_setPadConfig(162, GPIO_PIN_TYPE_STD); GPIO_setPinConfig(GPIO_162_GPIO162); GPIO_setDirectionMode(162, GPIO_DIR_MODE_OUT); GPIO_setMasterCore(162, GPIO_CORE_CPU2);
但是、从内核2运行 GPIO_writePin ()函数似乎不起作用。 我尝试了一些其他引脚、也尝试了内核1中的引脚、这似乎不再起作用。
然后、我决定尝试使用附带的 LED 演示、但没有成功(请参阅下面的)。 我对其进行了设置、以便可以使用编译配置和定义的符号来针对同一工程的不同内核(因此预处理器定义门控)。
#include "driverlib.h"
#include "device.h"
#define DEVICE_GPIO_PIN_LED1 59
#define DEVICE_GPIO_PIN_LED2 162
#ifdef CPU1
void main(void)
{
//
// Initialize device clock and peripherals
//
Device_init();
//
// Initialize GPIO and configure the GPIO pin as a push-pull output
//
Device_initGPIO();
GPIO_setPadConfig(DEVICE_GPIO_PIN_LED1, GPIO_PIN_TYPE_STD);
GPIO_setDirectionMode(DEVICE_GPIO_PIN_LED1, GPIO_DIR_MODE_OUT);
GPIO_setPadConfig(DEVICE_GPIO_PIN_LED2, GPIO_PIN_TYPE_STD);
GPIO_setDirectionMode(DEVICE_GPIO_PIN_LED2, GPIO_DIR_MODE_OUT);
//
// Configure CPU2 to control the LED GPIO
//
GPIO_setMasterCore(DEVICE_GPIO_PIN_LED2, GPIO_CORE_CPU2);
//
// Initialize PIE and clear PIE registers. Disables CPU interrupts.
//
Interrupt_initModule();
//
// Initialize the PIE vector table with pointers to the shell Interrupt
// Service Routines (ISR).
//
Interrupt_initVectorTable();
//
// Enable Global Interrupt (INTM) and realtime interrupt (DBGM)
//
EINT;
ERTM;
//
// Loop Forever
//
for(;;)
{
//
// Turn on LED
//
GPIO_writePin(DEVICE_GPIO_PIN_LED1, 0);
//
// Delay for a bit.
//
DEVICE_DELAY_US(500000);
//
// Turn off LED
//
GPIO_writePin(DEVICE_GPIO_PIN_LED1, 1);
//
// Delay for a bit.
//
DEVICE_DELAY_US(500000);
}
}
#endif
#ifdef CPU2
void main(void)
{
//
// Initialize device clock and peripherals
//
Device_init();
//
// Initialize GPIO and configure the GPIO pin as a push-pull output
//
// This is configured by CPU1
//
// Initialize PIE and clear PIE registers. Disables CPU interrupts.
//
Interrupt_initModule();
//
// Initialize the PIE vector table with pointers to the shell Interrupt
// Service Routines (ISR).
//
Interrupt_initVectorTable();
//
// Enable Global Interrupt (INTM) and realtime interrupt (DBGM)
//
EINT;
ERTM;
//
// Loop Forever
//
for(;;)
{
//
// Turn on LED
//
GPIO_writePin(DEVICE_GPIO_PIN_LED2, 0);
//
// Delay for a bit.
//
DEVICE_DELAY_US(500000);
//
// Turn off LED
//
GPIO_writePin(DEVICE_GPIO_PIN_LED2, 1);
//
// Delay for a bit.
//
DEVICE_DELAY_US(500000);
}
}
#endif
我设置了存储器映射、以便 CPU1将 GS0用作其.sysmem 段、CPU2将 GS1用作其.system 段、如果这是值得的。
如果有任何指示,将不胜感激。
