Подскажите пожалуйста как пользоватся апаратной SPI у TMS470 ?
Немогу разобратся в примерах от производителля.
Код
//*****************************************************************************
// TMS470 Demo - SPI Sample Program master 3pin rti
//
// This is a SPI 3 pin - Master Mode - RTI Interrupt configuration.
// Data from a table is transmitted from SPI 1 based on the RTI timing.
// This is a 3 pin configuration using SIMO SPICLK SOMI pins. Clock speed 12 Mhz.
//
//
// TMS-FET470B1M
// _________________
// | |
// /|\| OSCIN|-
// | | | 7.5MHz
// --|PLLDIS OSCOUT|-
// | |
// ---|SPICLK SIMO|---
// | |
// | SOMI|---
// | |
// |_________________|
//
//
//
//
// J. Mangino / L.Westlund
// Texas Instruments, Inc
// August 12 2005
// Built with IAR Embedded Workbench Version: 4.30A
//******************************************************************************
#include <intrinsic.h>
#include "iotms470r1b1m.h"
#include "tms470r1b1m_bit_definitions.h"
// LED moving pattern codes.
int led_table[] = {
0x0000,0x0001,0x0002,0x0004,0x0008,0x0010,0x0020,0x0040,0x0080,0x0100,0x0200,0x0
400,0x0800,0x1000,0x2000,0x4000,0x8000, 0xffff
};
unsigned int datp;
int* ip;
void COMP1_irq_handler()
{
RTICINT = 0x00; // interrupt control, clear CMP1 and enable CMP1 interrupt
RTICINT = 0x20;
if (*ip != 0xffff)
{
SPI1DAT0 = *ip;
ip++;
}
else
{
ip = led_table;
SPI1DAT0 = *ip;
ip++;
}
}
//------------------------------------------------------------------------------
// TMS470R1A256 Standard Interrupt Handler
//------------------------------------------------------------------------------
__irq __arm void irq_handler(void)
{
switch((0xff & IRQIVEC)-1)
{
case CIM_COMP1 : COMP1_irq_handler(); break;
}
}
void main(void)
{
// Set up peripheral registers.
// First disable interrupts.
__disable_interrupt();
ip = led_table;
// Setup system.
PCR = CLKDIV_4; // ICLK = SYSCLK/4
PCR |= PENABLE; // enable peripherals
REQMASK = (1 << CIM_COMP1); // Enable SPI Interrupt mask
// Setup periodic interrupt using RTI with RTICMP1
RTICNTEN = 0x03; // Stop counting
RTICNTR = 0; // clear 21-bits CNTR
// Setup periodic interrupt timer
// CMP1 used to generate interrupt.
RTIPCTL = 0x3; // preload 11-bits MOD
RTICMP1 = 0xfffff; //
RTICNTL = 0x00; // clear and disable tap
// interrupt control, clear CMP1 and enable CMP1 interrupt
RTICINT = 0x00;
RTICINT = 0x20;
// Start count, CNTR and MOD will count in both USER and SYSTEM mode
RTICNTEN = 0x00;
// SPI 1 Setup
SPI1CTRL1= CHARLEN_16 + PRESCALE_1; // char len = 16 prescale =1 spi baud =Iclk/2
SPI1CTRL2 = MASTER + CLKMOD; // Master mode
SPI1CTRL3 = 0x00; // Disable SPI1 Interrupt
SPI1PC6=SOMI_FUN + SIMO_FUN + CLK_FUN; // SOMI SIMO SPICLK enables
SPI1CTRL2 |= SPIEN; // Enable SPIs
datp = SPI1BUF; // Dummy Read to clear buffer
SPI1DAT0 = 0x00f0;
__enable_interrupt(); // Enable Interrupts
// Loop forever.
while (1);
}
Здесь непонятно куда нужно запихивать данные для передачи на внешнее устройсво.
И вообще как этот пример реально применить.
Сильно не пинайте поскольку я начинающий програмёр.

Подскажите пожалуйста как пользоватся апаратной SPI у TMS470 ?
Немогу разобратся в примерах от производителля.
[code]//*****************************************************************************
// TMS470 Demo - SPI Sample Program master 3pin rti
//
// This is a SPI 3 pin - Master Mode - RTI Interrupt configuration.
// Data from a table is transmitted from SPI 1 based on the RTI timing.
// This is a 3 pin configuration using SIMO SPICLK SOMI pins. Clock speed 12 Mhz.
//
//
// TMS-FET470B1M
// _________________
// | |
// /|\| OSCIN|-
// | | | 7.5MHz
// --|PLLDIS OSCOUT|-
// | |
// ---|SPICLK SIMO|---
// | |
// | SOMI|---
// | |
// |_________________|
//
//
//
//
// J. Mangino / L.Westlund
// Texas Instruments, Inc
// August 12 2005
// Built with IAR Embedded Workbench Version: 4.30A
//******************************************************************************
#include <intrinsic.h>
#include "iotms470r1b1m.h"
#include "tms470r1b1m_bit_definitions.h"
// LED moving pattern codes.
int led_table[] = {
0x0000,0x0001,0x0002,0x0004,0x0008,0x0010,0x0020,0x0040,0x0080,0x0100,0x0200,0x0
400,0x0800,0x1000,0x2000,0x4000,0x8000, 0xffff
};
unsigned int datp;
int* ip;
void COMP1_irq_handler()
{
RTICINT = 0x00; // interrupt control, clear CMP1 and enable CMP1 interrupt
RTICINT = 0x20;
if (*ip != 0xffff)
{
SPI1DAT0 = *ip;
ip++;
}
else
Подскажите пожалуйста как пользоватся апаратной SPI у TMS470 ?
Немогу разобратся в примерах от производителля.
[code]//*****************************************************************************
// TMS470 Demo - SPI Sample Program master 3pin rti
//
// This is a SPI 3 pin - Master Mode - RTI Interrupt configuration.
// Data from a table is transmitted from SPI 1 based on the RTI timing.
// This is a 3 pin configuration using SIMO SPICLK SOMI pins. Clock speed 12 Mhz.
//
//
// TMS-FET470B1M
// _________________
// | |
// /|\| OSCIN|-
// | | | 7.5MHz
// --|PLLDIS OSCOUT|-
// | |
// ---|SPICLK SIMO|---
// | |
// | SOMI|---
// | |
// |_________________|
//
//
//
//
// J. Mangino / L.Westlund
// Texas Instruments, Inc
// August 12 2005
// Built with IAR Embedded Workbench Version: 4.30A
//******************************************************************************
#include <intrinsic.h>
#include "iotms470r1b1m.h"
#include "tms470r1b1m_bit_definitions.h"
// LED moving pattern codes.
int led_table[] = {
0x0000,0x0001,0x0002,0x0004,0x0008,0x0010,0x0020,0x0040,0x0080,0x0100,0x0200,0x0
400,0x0800,0x1000,0x2000,0x4000,0x8000, 0xffff
};
unsigned int datp;
int* ip;
void COMP1_irq_handler()
{
RTICINT = 0x00; // interrupt control, clear CMP1 and enable CMP1 interrupt
RTICINT = 0x20;
if (*ip != 0xffff)
{
SPI1DAT0 = *ip;
ip++;
}
else