I am using a CC1352P1 Launchpad from TI to connect with an ENC28J60 SPI-Ethernet bridge chip. I wanted to confirm first that I am able to get a response from the ENC28J60, so I tried to write to a register and read back the value I just wrote to that register. I am using a 4MHz SPI clock from the CC1352P1 master, with a polarity of 0 and a phase of 0.

For example, I wrote a value of 0b10101010 to the ERXSTL register at address 0x08 in the first bank. To do this, I wrote the value 0b 010 01000 10101010 or 0b01001000 10101010. I first sent in the byte with value 72 (or 0b01001000) and then sent in the byte with value 170 (0b10101010). I can see the SPI clock coming out of the CC1352P1, set at 4MHz, and I can see the Chip select from the CC1352P1 master go low during each byte transfer on my oscilloscope. I can also see the values that I am writing go out MSB first (namely, 0b01001000 and 0b10101010) on the MOSI line my oscilloscope. Then, when I try to read back this same register, I send the instruction 0b 000 01000 00000000 or 0b 00001000 00000000 or 0x08 as the first byte and 0x00 as the second byte. I am checking the MISO line on my oscilloscope, and I always see the last bit go high, every other bit is always low.

I tried also to read back the EREVID register by first setting the BSEL1 and BSEL0 bits to 11 to select the third bank, then reading from address 0x12 by sending in the following two bytes : 0b 000 10010 0000 0000 or first byte 0x12, second byte 0x00. I always get back 0x01, on the MISO line.

I tried setting the PHLCON register to get the LEDs to blink as well, by first writing the address of PHLCON (0x14) into the MIREGADR register, then writing the value 172 to write into MIWRL, then sending 59 into the higher 8 bits to write into MIWRH register. I did not get any response.

I am sure that the SPI communication on the CC1352P1 works since I have tested it with two CC1352P1 boards, one as a master and one as a slave, and I am also seeing the SPI clock generated and seeing the chip select go low when a byte is being transferred. Please help me out with what might be going wrong.

I am also not able to see any signal on the OSC1 or OSC2 pins on the chip, but I'm able to see a 6.25 MHz CLKOUT signal from the chip.

  • \$\begingroup\$ do not assume that any register will read back the same data that was written to it \$\endgroup\$ – jsotola Oct 24 '19 at 1:09
  • \$\begingroup\$ I am getting the same response on the MISO no matter which register I'm writing to. For example, if I try to read the EREVID register, I should get the silicon revision ID, but I am not getting this, instead I am getting 0x01 as always. Further, why can I not assume that a register will read back the same data that I just wrote to it? As long as it is a read/write register, this should be true, right? \$\endgroup\$ – Samyukta Ramnath Oct 24 '19 at 1:15
  • \$\begingroup\$ Can you show us scope captures for each of your examples? \$\endgroup\$ – Bruce Abbott Oct 24 '19 at 2:32
  • 1
    \$\begingroup\$ SPI chip select going low for each byte? It should go low once for each transaction, not for each byte. \$\endgroup\$ – Justme Oct 24 '19 at 5:22
  • 1
    \$\begingroup\$ I have never used ENC28J60 but in general this is how register based SPI chips work and maybe you should actually read ENC28J60 datasheet part where they explain how the SPI interface must be used. \$\endgroup\$ – Justme Oct 24 '19 at 6:22

Problem is in SPI protocol. Do not pulse chip select for each byte, keep it enabled for full command transaction.

  • \$\begingroup\$ You are correct, this solved my issue. \$\endgroup\$ – Samyukta Ramnath Oct 24 '19 at 16:18

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.