SPI issue S32k144 interfacing with RF Chip

キャンセル
次の結果を表示 
表示  限定  | 次の代わりに検索 
もしかして: 

SPI issue S32k144 interfacing with RF Chip

ソリューションへジャンプ
2,062件の閲覧回数
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 件の賞賛
返信
1 解決策
2,037件の閲覧回数
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 件の賞賛
返信
5 返答(返信)
982件の閲覧回数
daniellet
Contributor I

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

0 件の賞賛
返信
1,958件の閲覧回数
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 件の賞賛
返信
2,027件の閲覧回数
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 件の賞賛
返信
1,993件の閲覧回数
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 件の賞賛
返信
2,038件の閲覧回数
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 件の賞賛
返信