Bee click module

Discussion on projects that are created by users and posted on mikroElektronika website.
Post Reply
Author
Message
miruga27
Posts: 4
Joined: 27 Mar 2017 11:33

Bee click module

#1 Post by miruga27 » 27 Mar 2017 11:52

Hello everyone,

I've downloaded an example for communication between two transceivers and its communication for a PIC microcontroller
and after doing some changes i've found out that some functions were missing (SPI1_WRITE,SPI1_READ).
I attach the link to the code:

https://libstock.mikroe.com/projects/vi ... ck-example

Can u help me?
Thanks in advanced.

miruga27
Posts: 4
Joined: 27 Mar 2017 11:33

Re: Bee click module

#2 Post by miruga27 » 27 Mar 2017 15:58

I've seen that the problem is that i don´t have the SPI library. Could you please provide it to me?

Thank you.

User avatar
lana.arsic
mikroElektronika team
Posts: 1715
Joined: 15 Jan 2016 12:50

Re: Bee click module

#3 Post by lana.arsic » 28 Mar 2017 11:02

Hi,

I believe I have answered you on the ticket,
so I suggest to continue our correspondence there.

Kind regards,
Lana

miruga27
Posts: 4
Joined: 27 Mar 2017 11:33

Re: Bee click module

#4 Post by miruga27 » 29 Mar 2017 11:15

I've started to write the communication to interface PIC24FJ1024GB610 to the click module. However,
I'm not setting up the SPI module properly because always obtained '0' from reading a register.
I think the problem is related with the clk bus. PIC works at a frequency of 8MHz and Bee click
at 100KHz (selectable). Ideas?

Code: Select all

void SPI1_set_control(){   
    
    IEC0bits.SPI1IE = 0; /* dISABLE Interrupt Enable bit */
    SPI1CON1Lbits.SPIEN=0;//DISABLE spi MODULE
    SPI1BUFL=0; //CLEAR BUFFER
    SPI1CON1Lbits.ENHBUF=0;  //disable enhanced buffer mode
    IFS0bits.SPI1IF = 0;                   /* Clear IF bit */
    IPC2bits.SPI1IP = (0x0007);             /* Assign interrupt priority */
    IEC0bits.SPI1IE = 1; /*  Interrupt Enable bit */
    SPI1BRGL=0x0002;
    
    //pic24fj1024gb610 clock is 8MHz
    //Bee click clock is 100khz
    //CLKDIVbits.DOZEN=0;
    //CLKDIVbits.DOZE=010;//divide clock by by 128???
    SPI1CON1Hbits.AUDEN=0;   Audio protocol disabled
    SPI1CON1Lbits.SPISIDL=0;   Continues to operate in CPU Idle mode
    SPI1CON1Lbits.DISSDO=0; //SDO controlled by the module
    SPI1CON1Lbits.MODE=00; //8 bit mode
    SPI1CON1Lbits.SMP=0;   //Input data is sampled at the middle of data output time
    SPI1CON1Lbits.CKE=0;    //TX from idle clock state to active clock state
    SPI1CON1Lbits.SSEN=0;   //controlled by I/O
    SPI1CON1Lbits.CKP=0;    //idle state for clock is low level
    SPI1CON1Lbits.DISSDI=0; //SDI controlled by the module
    SPI1CON1Lbits.MSTEN=1;  //master enable
    SPI1CON1Lbits.SPIEN=1;  //spi enable
    

}


}

User avatar
lana.arsic
mikroElektronika team
Posts: 1715
Joined: 15 Jan 2016 12:50

Re: Bee click module

#5 Post by lana.arsic » 30 Mar 2017 15:59

Hi,

Can you tell me which compiler are you using?

Unfortunately, at this moment, our compilers for dsPIC don't support
PIC24FJ1024GB610, but I will suggest to our developers to add support.

Regarding setting SPI registers, you can take a look at the link bellow:

http://ww1.microchip.com/downloads/en/D ... 05136a.pdf

Kind regards,
Lana

Post Reply

Return to “User Projects”