cancel
Showing results for 
Search instead for 
Did you mean: 

Non Volatile RAM (F-RAM & NVSRAM)

LONGNIGHT
New Contributor II

I met a problem that I could detect signal output on the SDO pin of PIC microcontroller with oscilloscope, but the SO pin of FM25V05 did not reply to the data. When the SDO pin of PIC microcontroller or the SI pin of FM25V05 was touched by the conductor, the SO pin of FM25V05 would have data transmitted.

I have also checked that the soldering reliability is okay, on several boards, how can I fix this problem

So that's my code

/******************************************
WriteSPI 写单字节缓冲储存器
*******************************************/
void  WriteSPI(unsigned char i)
    {
    SSP1IF=0;          // clear SSP interrupt bit                   
    SSP1BUF=i;                            
    while(!SSP1IF);    // Wait for interrupt flag to go high indicating transmission is complete  
    return;
    }

/******************************************
** SPI_Write
*******************************************/
void Write_SPI_Byte(uchar n,ucharwr_data_p)       //写全部就定义0xffff
{  
    unsigned char  *fm_addr_p;
    uchar HI,LO;
    SPI_CS=0;
    WriteSPI(0x06);             //写入使能wren指令
    SPI_CS=1;
    __delay_us(10);
    SPI_CS=0;
    WriteSPI(0x02);             //写储存器
    fm_addr_p=(uchar*)&fm_addr;
    LO=*fm_addr_p;
    fm_addr_p++;
    HI=*fm_addr_p;  
    WriteSPI(HI);               //先写存储器地址高字节
    WriteSPI(LO);               //写存储器地址低字节      
    while(n--)
    {
    WriteSPI(*wr_data_p);       //写数据
    wr_data_p++;
    fm_addr++;
    }
    SPI_CS=1;                        //停止从机 
}

//**************************************************************************************
// ReadSPI 读单字节缓冲
//**************************************************************************************
unsigned char ReadSPI()
    {
    unsigned char databyte;
    SSP1IF=0;                    // Clear SSP interrupt bit
    SSP1BUF = 0x00;              // Write dummy data byte to the buffer to initiate transmission
    while(!SSP1IF);                 // Wait for interrupt flag to go high indicating transmission is complete
    databyte = SSP1BUF;          // Read the incoming data byte
    return (databyte);
    }
/******************************************
SPI_Read
*******************************************/

unsigned char Read_SPI_Byte()// 从储存器里读一个字节
  {
    uchar *fm_addr_p;               //定义地址指针
    uchar HI,LO;                    //定义写入地址
    uchar data_read;                //字节
    SSP1IF=0;
    SPI_CS=0;
    WriteSPI(0x03);                   //写读储存器命令
   
    fm_addr_p=(uchar*)&fm_addr;
    LO=*fm_addr_p;
    fm_addr_p++;
    HI=*fm_addr_p;
    WriteSPI(HI);             
    WriteSPI(LO);                        //写高低位地址         
    WriteSPI(0xff);                      //启动读数            
    data_read = ReadSPI();                  //输出数据
    fm_addr++;
    SPI_CS=1;
    return(data_read);
   }
0 Likes
4 Replies
PradiptaB_11
Moderator
Moderator

Hi,

Can you share the schematics for the FRAM and PIC controller. We can start by checking all the connections. Also can you provide the Scope shots for FRAM read/ write operations. (Also kindly mention where you connect the probes: near the FRAM or near the PIC controller.)

Thanks,

Pradipta.

0 Likes
LONGNIGHT
New Contributor II

Tek000.png

the probes:near the PIC controller

This is the graph that failed to read the data

 

This is the graph that reads the data successfully

Tek002.png

 

 

0 Likes
LONGNIGHT
New Contributor II

I think since I can successfully read the data, the program is probably OK, and I can't locate the problem

0 Likes
PradiptaB_11
Moderator
Moderator

Hi,

Can you probe near the FRAM. Also can you kindly provide the schematics for FRAM portion. The code does look ok and so it can be related to some issues in the connections. 

Thanks,

Pradipta.

0 Likes