SPI issue S32k144 interfacing with RF Chip

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

SPI issue S32k144 interfacing with RF Chip

Jump to solution
1,335 Views
Adhi_11
Contributor I

Hallo, I am a new user to S32k1xx series of MCU and working on my master thesis. I`m having some trouble interfacing an RF Chip to my µc. Once my API is executed, it is reported as hardware fault, and i cant identify the mistake. I want to just check if the SCK is active and MOSI is sending the data. Can someone please give me some guidance, i am not able to find support for this project, as S32k1xx is fairly new to some developers i know.

 

 

0 Kudos
1 Solution
1,310 Views
PetrS
NXP TechSupport
NXP TechSupport

Hi,

seems you did not enable clock properly for PORTC. So change a line

PCC-> PCCn[PCC_PORTD_INDEX] = PCC_PCCn_CGC_MASK; /* Enable clock to PORT D */

with 

PCC-> PCCn[PCC_PORTD_INDEX] |= PCC_PCCn_CGC_MASK; /* Enable clock to PORT D */
PCC-> PCCn[PCC_PORTC_INDEX] |= PCC_PCCn_CGC_MASK; /* Enable clock to PORT C */

then it passes port init and you should see signal on SPI output.

BR, Petr

View solution in original post

0 Kudos
5 Replies
255 Views
daniellet
Contributor I

Hello @Adhi_11. Were you able to resolve this problem? I am currently experiencing the same issue. 

0 Kudos
1,231 Views
Adhi_11
Contributor I

Thanks for checking. But now there seems to be a problem. I saw the output in my DSO a few days ago. But now its not working again. I even put the data tranmsit function on the for loop and it worked, but now the execution stops at the check TX fifo loop, what is even more strange is i tried the same for the example LPSPI program(non-processor expert) and the same problem. Changing the non stall bit on CFGR1 helped me last time. I don't understand this, is it the problem from hardware side. I did not made a changes on the example LPSPI, just removed the recieved function in void main, still the execution halts at the while loop as shown in picture. Kindly help me understand why. 

 

 

 

 

 111.png222.png

0 Kudos
1,300 Views
Adhi_11
Contributor I

Hello Petr,

I have modified the same and tried to send the data again, and unfortunately its not working for me. I have set PTB17 as GPIO, output as chip select. Theres also a function called chip enable, on PTD0 which is internally connected to BLUE LED. So i think it is the problem with my SPI transmit function, because at the end of my NRF24_Init() the chip enable should be high or maybe i didnt configure a delay between transfers. All my transfers should be 8 bits to the chip. Could you please replicate this behaviour and see if you can get the SCK and MOSI running, also please advice me what to do because i am stuck here. 

Regards,

Adhi

0 Kudos
1,266 Views
PetrS
NXP TechSupport
NXP TechSupport

Hi,

please use attached code. I did modification in pin init and CS handling. Also I modified nrf24_WriteReg function. Below is what I see for NRF24_Init

PetrS_0-1664872995718.png

 

BR, Petr

0 Kudos
1,311 Views
PetrS
NXP TechSupport
NXP TechSupport

Hi,

seems you did not enable clock properly for PORTC. So change a line

PCC-> PCCn[PCC_PORTD_INDEX] = PCC_PCCn_CGC_MASK; /* Enable clock to PORT D */

with 

PCC-> PCCn[PCC_PORTD_INDEX] |= PCC_PCCn_CGC_MASK; /* Enable clock to PORT D */
PCC-> PCCn[PCC_PORTC_INDEX] |= PCC_PCCn_CGC_MASK; /* Enable clock to PORT C */

then it passes port init and you should see signal on SPI output.

BR, Petr

0 Kudos