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.
Solved! Go to Solution.
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
Hello @Adhi_11. Were you able to resolve this problem? I am currently experiencing the same issue.
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.
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
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