Loading ...
Sorry, an error occurred while loading the content.

238Any issue on the SPI module of the Aduc7020 chip?

Expand Messages
  • stéph
    Sep 17, 2012
      I do encounter some spi issues with the ADUC7020.
      I amtrying to use it as a slave with a clock of 250Khz and clock phase=1 and clock polarity=1.

      I am using the polling of the SPISTA register.

      DOEs anyone has ever had this kind of issue ?

      My register SPICON is confugured with the value 0x150d

      HEre is the code i am using:

      stmdb r13!,{r0-r12,r14}


      ldr r1,=0xFFFF0A00 /* read SPISTA */
      ldr r2,=0xFFFF0A04 /* SPIRX */
      ldr r3,=0xFFFF0A08 /*SPITX*/


      ldr r0,[r1] /*read SPISTA */
      and r5,r0,#0x08 /* MASK with SPIRX register is full */
      cmp r5,#0x08
      beq rx_register_is_full
      and r5,r0,#0x10
      cmp r5,#0x10
      beq rx_register_is_full
      b wait_for_rx

      ldr r4,[r2] /*read SPIRX */
      str r4,[r3] /* copy the received byte in SPITX */
      mov r0,r4

      ldr r0,[r1] /* Get theSPISTA register */
      and r5,r0,#0x1 /* wait the SPITX register is empty */
      cmp r5,#0x1
      beq fill_tx_buffer

      b spistart_loop

      ldmia r13!,{r0-r12,r14}
      bx lr