TI中文支持网
TI专业的中文技术问题搜集分享网站

LIN兼容SCI模式下,无法实现对外发送LIN信号,请指点!

    完全 按照control suite里的例程(如下配置)Example_2803xLinSci_DLB_int,使用GPIO28和29,把loopback置0取消后,还是没办法对外发送信号,做了些尝试还是一样只输出12V高电平(用SCI验证过 外接LIN芯片可正常使用);

    请问:是不是还要配置什么才能实现对外发送LIN信号波形。

    急,在线等,谢谢~

void SetupSCI(void)
{
//Allow write to protected registers
EALLOW;

LinaRegs.SCIGCR0.bit.RESET = 0; //Into reset
LinaRegs.SCIGCR0.bit.RESET = 1; //Out of reset

LinaRegs.SCIGCR1.bit.SWnRST = 0; //Into software reset

//SCI Configurations
LinaRegs.SCIGCR1.bit.COMMMODE = 0; //Idle-Line Mode
LinaRegs.SCIGCR1.bit.TIMINGMODE = 1; //Asynchronous Timing
LinaRegs.SCIGCR1.bit.PARITYENA = 0; //No Parity Check
LinaRegs.SCIGCR1.bit.PARITY = 0; //Odd Parity
LinaRegs.SCIGCR1.bit.STOP = 0; //One Stop Bit
LinaRegs.SCIGCR1.bit.CLK_MASTER = 1; //Enable SCI Clock
LinaRegs.SCIGCR1.bit.LINMODE = 0; //SCI Mode
LinaRegs.SCIGCR1.bit.SLEEP = 0; //Ensure Out of Sleep
LinaRegs.SCIGCR1.bit.MBUFMODE = 1; //Buffered Mode
LinaRegs.SCIGCR1.bit.LOOPBACK = 1; //Internal Loopback ???
LinaRegs.SCIGCR1.bit.CONT = 1; //Continue on Suspend
LinaRegs.SCIGCR1.bit.RXENA = 1; //Enable RX
LinaRegs.SCIGCR1.bit.TXENA = 1; //Enable TX

//Ensure IODFT is disabled
LinaRegs.IODFTCTRL.bit.IODFTENA = 0x0;

//Set transmission length
LinaRegs.SCIFORMAT.bit.CHAR = 7; //Eight bits
LinaRegs.SCIFORMAT.bit.LENGTH = 7; //Eight bytes

//Set baudrate
LinaRegs.BRSR.bit.SCI_LIN_PSL = 96; //19.2 kbps for SYSCLKOUT = 60 MHz
LinaRegs.BRSR.bit.M = 10;

//Enable interrupts
LinaRegs.SCISETINT.bit.SETRXINT = 1; //Enable RX interrupt

//Set interrupt priority
LinaRegs.SCICLEARINTLVL.all = 0xFFFFFFFF; //Set Int level of all interrupts to LVL 0

LinaRegs.SCIGCR1.bit.SWnRST = 1; //bring out of software reset

//Disable write to protected registers
EDIS;
}

Johnson Chen1:

请问你是要做LIN 功能还是SCI功能,如果是LIN功能的话,请参考lina_external_loopback例程。

    完全 按照control suite里的例程(如下配置)Example_2803xLinSci_DLB_int,使用GPIO28和29,把loopback置0取消后,还是没办法对外发送信号,做了些尝试还是一样只输出12V高电平(用SCI验证过 外接LIN芯片可正常使用);

    请问:是不是还要配置什么才能实现对外发送LIN信号波形。

    急,在线等,谢谢~

void SetupSCI(void)
{
//Allow write to protected registers
EALLOW;

LinaRegs.SCIGCR0.bit.RESET = 0; //Into reset
LinaRegs.SCIGCR0.bit.RESET = 1; //Out of reset

LinaRegs.SCIGCR1.bit.SWnRST = 0; //Into software reset

//SCI Configurations
LinaRegs.SCIGCR1.bit.COMMMODE = 0; //Idle-Line Mode
LinaRegs.SCIGCR1.bit.TIMINGMODE = 1; //Asynchronous Timing
LinaRegs.SCIGCR1.bit.PARITYENA = 0; //No Parity Check
LinaRegs.SCIGCR1.bit.PARITY = 0; //Odd Parity
LinaRegs.SCIGCR1.bit.STOP = 0; //One Stop Bit
LinaRegs.SCIGCR1.bit.CLK_MASTER = 1; //Enable SCI Clock
LinaRegs.SCIGCR1.bit.LINMODE = 0; //SCI Mode
LinaRegs.SCIGCR1.bit.SLEEP = 0; //Ensure Out of Sleep
LinaRegs.SCIGCR1.bit.MBUFMODE = 1; //Buffered Mode
LinaRegs.SCIGCR1.bit.LOOPBACK = 1; //Internal Loopback ???
LinaRegs.SCIGCR1.bit.CONT = 1; //Continue on Suspend
LinaRegs.SCIGCR1.bit.RXENA = 1; //Enable RX
LinaRegs.SCIGCR1.bit.TXENA = 1; //Enable TX

//Ensure IODFT is disabled
LinaRegs.IODFTCTRL.bit.IODFTENA = 0x0;

//Set transmission length
LinaRegs.SCIFORMAT.bit.CHAR = 7; //Eight bits
LinaRegs.SCIFORMAT.bit.LENGTH = 7; //Eight bytes

//Set baudrate
LinaRegs.BRSR.bit.SCI_LIN_PSL = 96; //19.2 kbps for SYSCLKOUT = 60 MHz
LinaRegs.BRSR.bit.M = 10;

//Enable interrupts
LinaRegs.SCISETINT.bit.SETRXINT = 1; //Enable RX interrupt

//Set interrupt priority
LinaRegs.SCICLEARINTLVL.all = 0xFFFFFFFF; //Set Int level of all interrupts to LVL 0

LinaRegs.SCIGCR1.bit.SWnRST = 1; //bring out of software reset

//Disable write to protected registers
EDIS;
}

user5864952:

回复 Johnson Chen1:

请问如果在280049上开发,例程也通用吗

    完全 按照control suite里的例程(如下配置)Example_2803xLinSci_DLB_int,使用GPIO28和29,把loopback置0取消后,还是没办法对外发送信号,做了些尝试还是一样只输出12V高电平(用SCI验证过 外接LIN芯片可正常使用);

    请问:是不是还要配置什么才能实现对外发送LIN信号波形。

    急,在线等,谢谢~

void SetupSCI(void)
{
//Allow write to protected registers
EALLOW;

LinaRegs.SCIGCR0.bit.RESET = 0; //Into reset
LinaRegs.SCIGCR0.bit.RESET = 1; //Out of reset

LinaRegs.SCIGCR1.bit.SWnRST = 0; //Into software reset

//SCI Configurations
LinaRegs.SCIGCR1.bit.COMMMODE = 0; //Idle-Line Mode
LinaRegs.SCIGCR1.bit.TIMINGMODE = 1; //Asynchronous Timing
LinaRegs.SCIGCR1.bit.PARITYENA = 0; //No Parity Check
LinaRegs.SCIGCR1.bit.PARITY = 0; //Odd Parity
LinaRegs.SCIGCR1.bit.STOP = 0; //One Stop Bit
LinaRegs.SCIGCR1.bit.CLK_MASTER = 1; //Enable SCI Clock
LinaRegs.SCIGCR1.bit.LINMODE = 0; //SCI Mode
LinaRegs.SCIGCR1.bit.SLEEP = 0; //Ensure Out of Sleep
LinaRegs.SCIGCR1.bit.MBUFMODE = 1; //Buffered Mode
LinaRegs.SCIGCR1.bit.LOOPBACK = 1; //Internal Loopback ???
LinaRegs.SCIGCR1.bit.CONT = 1; //Continue on Suspend
LinaRegs.SCIGCR1.bit.RXENA = 1; //Enable RX
LinaRegs.SCIGCR1.bit.TXENA = 1; //Enable TX

//Ensure IODFT is disabled
LinaRegs.IODFTCTRL.bit.IODFTENA = 0x0;

//Set transmission length
LinaRegs.SCIFORMAT.bit.CHAR = 7; //Eight bits
LinaRegs.SCIFORMAT.bit.LENGTH = 7; //Eight bytes

//Set baudrate
LinaRegs.BRSR.bit.SCI_LIN_PSL = 96; //19.2 kbps for SYSCLKOUT = 60 MHz
LinaRegs.BRSR.bit.M = 10;

//Enable interrupts
LinaRegs.SCISETINT.bit.SETRXINT = 1; //Enable RX interrupt

//Set interrupt priority
LinaRegs.SCICLEARINTLVL.all = 0xFFFFFFFF; //Set Int level of all interrupts to LVL 0

LinaRegs.SCIGCR1.bit.SWnRST = 1; //bring out of software reset

//Disable write to protected registers
EDIS;
}

Susan Yang:

回复 user5864952:

在C200WARE内的例程路径为:

C:\ti\c2000\C2000Ware_1_00_06_00\driverlib\f28004x\examples\lin

lin_ex1_loopback_interrupts 而不是 lina_external_loopback

另外请您有问题重新发帖,请不要跟踪旧贴,谢谢

赞(0)
未经允许不得转载:TI中文支持网 » LIN兼容SCI模式下,无法实现对外发送LIN信号,请指点!
分享到: 更多 (0)