Post Go back to editing

how i can verify my read function for ADF4159 device?

Category: Software
Product Number: ADF4159
Software Version: Cross Core Embedded Studio

void SpiRead(void)
{
int i;
*pPORTB = *pPORTB & ~(1 << 10);// TxData = 0
*pPORTB = *pPORTB & ~(1 << 12);// CLK =0
*pPORTB = *pPORTB | (1 << 9);// LE = 1

*pPORTB = *pPORTB | (1 << 10);// TxData = 1

for(i = 36; i >= 0 ; i--)
{
*pPORTB = *pPORTB | (1 << 12);// CLK = 1
*pPORTB = *pPORTB & ~(1 << 10);// TxData = 0

printf("%d",(*pPORTB >> 14) & 1);
//arr[i] = ;
*pPORTB = *pPORTB & ~(1 << 12);// CLK = 0
}

//*pPORTB = *pPORTB & ~(1 << 12);// CLK = 0
*pPORTB = *pPORTB & ~(1 << 9);// LE = 0
}



my write function is able to write data on ADF4159 that i have configure.but when i will call My read function that time im getting output = 0x00000000 from ADF4159 device . during this read call my clock pin is giving proper pulses that i have check .MUXOUT pin is giving proper pulses im not able to understand whether my read function is working proper or not?
[edited by: paija at 10:00 AM (GMT -5) on 13 Jan 2023]
Parents Reply Children
  • thank you ,for the reply.

    i have written MUXOUT value as SERIAL DATA OUTPUT then also my read function is not giving proper output . if you have any reference  or example please provide to me.....

  • Hi,

    Unlike writing, the LE pin should be held High while reading register values. can this be your problem with reading?

    Write:

    Read:

    Regards,
    Emrecan

  • I have an SPI problem with the ADSP-BF548.

    I'm using spi1, which is linked to three slaves.

    I completed the Post configuration, the SPI1 init sequence, and the Spi transfer function in accordance with the datasheet.

    I've included my source code below, too.


    void PortInit(void)
    {
    *pPORTG_MUX = 0x0000;
    *pPORTG_FER = PG8/*SPI1SCLK*/ | PG9/*SPI1SO*/ | PG10/*SPI1SI*/;//Enable pins
    *pPORTG_FER = PG5; // Selection of SPI1SS1

    *pPORTG_MUX = (*pPORTG_MUX) & ~(1 << 10) ;//for SPI1SS1
    *pPORTG_MUX = (*pPORTG_MUX) & ~(1 << 11) ;//for SPI1SS1

    *pPORTG_MUX = (*pPORTG_MUX) & ~(1 << 16) ;//for SPI1SCLK
    *pPORTG_MUX = (*pPORTG_MUX) & ~(1 << 17) ;//for SPI1SCLK

    *pPORTG_MUX = (*pPORTG_MUX) & ~(1 << 18) ;//for SPI1SO
    *pPORTG_MUX = (*pPORTG_MUX) & ~(1 << 19) ;//for SPI1SO

    *pPORTG_MUX = (*pPORTG_MUX) & ~(1 << 20) ;//for SPI1SI
    *pPORTG_MUX = (*pPORTG_MUX) & ~(1 << 21) ;//for SPI1SI

    ssync();
    }

    void SpiInit(void)
    {
    *pSPI1_FLG = 0xF102;
    *pSPI1_BAUD = 0x208E;

    *pSPI1_CTL = 0x5908;//

    }

    void SpiTransfer(void)
    {
    *pSPI1_FLG = *pSPI1_FLG | 0x0200;//SPI1 slave select 1

    *pSPI1_TDBR = 0xFFFF;
    DelayCall(40000);
    printf("read register 0X%d\n",*pSPI1_RDBR);
    }

    my main function is containing sequence like ...

    int main(){

    PortInit();

    SpiInit()

    SpiTransfer();

    }

    output im getting from this is : *pSPI1_RDBR = 0x0;

    Please assist in fixing this problem, or if you have any source code or good instructions, send it too me.

    In advance, I appreciate it.

  • Hi, 

    If your question is related to Blackfin processors, I strongly recommend posting it to Blackfin Processors Group. Questions are assigned according to their application engineers.

     Blackfin Processors - EngineerZone (analog.com)