Hi,
We use STM32F101 as the host to access C5517's SARAM through the UHPI. We can write data to the SARAM(address >= 0x10000), but when read, only the 2nd halfword is corect, the 1st halfword is always 0.
Host accessses using /UHPI_HAS, the Host and C5517 UHPI interface connect is :
C5517 HOST(STM32F101)
UHPI_HD[15..0] D[15..0]
UHPI_HCNTL0 D[5]
UHPI_HCNTL1 D[6]
UHPI_HR_NW D[7]
UHPI_HHWIL D[8]
UHPI_HRDY /READY ( Bus Ready )
UHPI_HDS1 /WR & /RD ( Write and Read )
UHPI_HDS2 1
UHPI_HCS CS (chip select)
UHPI_HAS /ALE (address enable )
UHPI_HBE0 0
UHPI_HBE1 0
we use Dual UHPIA mode(DUAL_UHPIA = 1 ) and First half-word is least significant( HWOB = 1).
The C code host accessing the UHPI is:
void HPIC( uint8_t RW_SEL ) //RW_SEL is read(1) or write(0) Register select.
{
*DSP_CS = 0x201 | (RW_SEL?0x800:0); //DSP_CS is the DSP chip select address; DUAL_UHPIA=1, HWOB = 1
}:
void WriteDSP( uint32_t dsp_address, uint32_t dsp_data)
{
uint32_t addr;
//set HPIC
HPIC(0);
if( dsp_addr < 0x10000 )addr = (dsp_addr+0x10000)/4;
else addr = (dsp_addr+0x80000)/4;
//write HPIA
*(DSP_CS+0x40) = (uint16_t)(addr & 0xffff);//set address low
*(DSP_CS+0x140) = (uint16_t)((addr >>16)&0xffff);//set address high
//write HPID
*(DSP_CS+0x60)=(uint16_t)(dsp_data & 0xffff);//set data low
*(DSP_CS+0x160)=(uing16_t)((dsp_addr>>16)&0xffff);
}
uint 32_t ReadDsp( uint32_t dsp_addr )
{
uint32_t addr, data;
uint16_t data_0, data_1;
//set HPIC
HPIC(1);
//write HPIA
if( dsp_addr <0x10000)addr = (dsp_addr + 0x10000)/4;
else addr=(dsp_addr+0x80000)/4;
*(DSP_CS+0x40)=(uint16_t)(addr & 0xffff); //set address low
*(DSP_CS+0x140)=(uint16_t)((addr>>16)&0xffff);//set address high
//read HPID
data_0 = *(DSP_CS+0xe0); //read data low
data _1= *(DSP_CS+0x1e0); //read data high
data = data_0+(data_1<<16);
return data;
}
The write data to SARAM is correct and I verify it with CCS . But the read data is error with 1st halfword return 0( data_0 =0, data_1 is correct;).
We can capture the read and write ttiming with FPGA SignalTap Logic Analyzer., But I don't know how to put it here.
Best Regards,
Dudechao