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.

TMS320C6748: TMS320C6748使用UPP发送,却没有数据

Part Number: TMS320C6748

 使用这个芯片与fpga通过uppA进行通信,dsp这把发送数据,fpga接收数据,但是每次都只有时钟信号没有数据。

/*
 * main.c
 */

#include <stdio.h>
#include <c6x.h>

#include "soc_C6748.h"              // DSP C6748 外设寄存器
#include "psc.h"                    // 电源与睡眠控制宏及设备抽象层函数声明
#include "interrupt.h"              // DSP C6748 中断相关应用程序接口函数声明及系统事件号定义
#include "uartStdio.h"              // 串口标准输入输出终端函数声明
#include "upp.h"                    // 通用并行端口设备抽象层函数声明
#include "dspcache.h"
// 全局变量
volatile int upp_error_count = 0;
volatile int upp_interrupt_count = 0;
// 使用缓存
#define CacheEnabled         1

// 配置
#define upp_line_size        (128)
#define upp_line_count       (1)
#define upp_frame_size       (upp_line_size * upp_line_count)
#define upp_line_offset      (upp_line_size)


// 接收 / 发送缓存变量
#pragma DATA_ALIGN(upp_buffer_a, 8)//64位对齐,一个字节8位,8*8=64
unsigned short upp_buffer_a[upp_frame_size];

// 通道参数
uPPDMAConfig transposeParA;

void OmaplFpgauPPSetup(void)
{
    // 外设使能
    PSCModuleControl(SOC_PSC_1_REGS, HW_PSC_UPP, PSC_POWERDOMAIN_ALWAYS_ON, PSC_MDCTL_NEXT_ENABLE);

    // 引脚复用配置
    uPPPinMuxSetup(uPP_CHA_16BIT);

    // uPP复位
    uPPReset(SOC_UPP_0_REGS);

    // 数据格式配置
    uPPDataFmtConfig(SOC_UPP_0_REGS, uPP_CHA, uPP_DataPackingFmt_LJZE | uPP_DataPacking_FULL
                            | uPP_InterfaceWidth_16BIT | uPP_DataRate_SINGLE);

    // 通道配置
    uPPChannelConfig(SOC_UPP_0_REGS, uPP_DDRDEMUX_DISABLE | uPP_SDRTXIL_DISABLE | uPP_CHN_ONE
                            | uPP_ALL_TRANSMIT);

    // 引脚配置
    uPPPinConfig(SOC_UPP_0_REGS, uPP_CHA, uPP_PIN_ENABLE | uPP_PIN_WAIT | uPP_PIN_START);

    // 时钟配置
    // uPPCLK = (CPUCLK / 2) / (2 * (DIV + 1) (DIV = 0, 1, 2, 3 ... 15)
    // 456MHz 主频下支持的时钟 114MHz、57MHz、38MHz、28.5MHz、22.8MHz ......
    uPPClkConfig(SOC_UPP_0_REGS, uPP_CHA, 57000000/2, 228000000/2, uPP_PIN_PHASE_NORMAL);

    // 空闲输出配置
    uPPIdleValueConfig(SOC_UPP_0_REGS, uPP_CHA, 0xAAAA);
    // uPP使能
    uPPEnable(SOC_UPP_0_REGS);
}

void main(void)
{
    int i,target_int_count = 2;
    if(CacheEnabled)
    {
        // 使能缓存
        CacheEnableMAR((unsigned int)0xC0000000, (unsigned int)0x10000000);//一个地址一个字节
        CacheEnable(L1PCFG_L1PMODE_32K | L1DCFG_L1DMODE_32K | L2CFG_L2MODE_256K);
    }

    // uPP 外设初始化
    OmaplFpgauPPSetup();

    // A 通道参数 接收
    transposeParA.WindowAddress     = (unsigned int *)((int)upp_buffer_a);
    transposeParA.LineCount         = upp_line_count;
    transposeParA.ByteCount         = (upp_line_size*sizeof(unsigned short));
    transposeParA.LineOffsetAddress = (upp_line_offset*sizeof(unsigned short));

while(1)
{
        upp_error_count = 0;
        upp_interrupt_count = 0;
        for (i = 0; i < upp_frame_size; i++)
        {
           upp_buffer_a[i] = i;
        }
        if(CacheEnabled)
        {
            CacheWB ((unsigned int)upp_buffer_a, sizeof(upp_buffer_a));
        }

        // uPP A 通道启动发送
        uPPDMATransfer(SOC_UPP_0_REGS, uPP_DMA_CHI, &transposeParA);
        // 等待 uPP 传输完毕
        while (upp_interrupt_count < target_int_count && upp_error_count == 0)
        {

        }

    }
}


 这个000e是我uppA在nand flash状态下的值