When I use smart configurator to add the RSPI function, I have encountered some questions and hope to get answers.
After using the smart configurator to add the RSPI function, there is a problem with using open/close/read/write through the API.
For example, write data does not see the RSPI signal(RSPCK/MOSI/MISO/SSL)
If you can hope, I will thank you so much.
Are you trying to output an RSPI signal from the pins (pin22, 23, 24, 26) of the CN2 on the Sub board?If so, make sure the board's swtich is:
<<Setting for CPU board>> - SW1-1…
How's it going? Unfortunately I couldn't find proper online sources regarding your inquiry. I hope you can wait for our experts to provide technical assistance. Thank you for your patience.
All the best!
SaiRenesasRulz Forum Moderator
https://renesasrulz.com/ https://academy.renesas.com/ en-support.renesas.com/knowledgeBase
I think I should try to program by myself.
If you register the RSPI driver in the smart configurator, the pins of RSPI will not be set.
As shown in the image below, there is a pin setting item for RSPI in the pins tab of smart configrator.
If this is not set, no RSPI signal will be output.
Are you setting this?
Also, have you confirmed that the driver is called correctly by setting breakpoints in the RSPI driver source code on e2studio?
Yes, this is the problem I am currently experiencing.
I have set up RSPI in the pins tab of smart configurator and no signal output.
I have tried to change RSPCK/MOSI/MISO/SSL to GPIO(P84/P85/P86/P87), and did the high/ow toggle test.
Is there any other way to provide testing?
Can you review the points shown below?
- What is your RZ/A2M board? Is it RSK board? or custom board?And is the pin setting suitable for that board?
- When you set a breakpoint in the rspi_master_transfer () function in generate \ sc_drivers \ r_rspi \ src \ lld \ r_rspi_lld_prv_rza2m.c, does this function stop? If it does not stop, the driver may have failed to open.
- When you set a breakpoint in the rspi_int_spei_proc_handler () function in generate \ sc_drivers \ r_rspi \ src \ lld \ r_rspi_lld_prv_rza2m.c, does this function stop?If it does not stop, it is possible that the RSPI interrupt is not working due to an interrupt from another device.In this case, consider the interrupt priority.
First of all thank for your guidance.
I explain the test environment.
I use API functions to write RSPI open/close/write/read programs, but rspi_int_spei_proc_handler/rspi_master_transfer is not used.
This problem may be programming error?
The following is the RSPI program I wrote for your reference.
The RSPI driver does not communicate with write() and read().It communicates with the control() whose control_command is "CTL_RSPI_TRANSFER".Please see Chapter 4.4 of generate \ sc_drivers \ r_rspi \ doc \ r01an5412ej0100-rza2m-rspi-driver-gcc.pdf for how to use it.
I use control-set configuration to RSPI parameters.
And I didn't see the SPCR has been changed.
But use the open() command to see the change.
Why is it?
Does it mean that the value of the SPCR register does not change even though the setting is changed with the control code "CTL_RSPI_SET_CONFIG"?This register is rewritten when changing the setting when switching between master mode and slave mode.I don't think there are many cases where the master and slave are switched after open().Are you changing between master mode and slave mode?
Yes, the SPCR can't be changed using the control code "CTL_RSPI_SET_CONFIG".
After testing, it is found that SPCR can only be changed by using open().
Can you provide sample code for RSPI?
The test process is as follows
All RSPI registers are 0 in your screenshot, are you calling open() at this time?When using the driver, first call open() to import the smartconfigrator settings.CTL_RSPI_TRANSFER is used to change the open() setting.
The value of the SPCR register changes when switching between master mode and slave mode with CTL_RSPI_SET_CONFIG or when SPI communicating with CTL_RSPI_TRANSFER.I don't have a sample to switch between master mode and slave mode after open().
All RSPI registers are 0 in your screenshot, is open() running at this time?When using the driver, first execute open() to import the smartconfigrator settings.
In your sample, rspi_mode = RSPI_MODE_MASTER is set, so if the master mode is set at open (), the SPCR register will not be rewritten.But I don't have a sample to switch between master mode and slave mode after open ().
In the first question you said that no RSPI signal was output.
Is this issue related to the value in the SPCR register?
In the previous picture, the open() function has not been shown yet.
I re-tested and used open() to import smart configurator setting.
And use CTL_RSPI_SET_CONFIG to change RSPI settings.
After that, I used control - SPI transfer again.
But I didn't see any data sent.
So I want to ask, is there any RSPI IO set when importing smart configurator settings using open()?
<<Setting for CPU board>> - SW1-1 : ON (Disabled SSCG function) SW1-2 : OFF (Setting to clock mode 1(EXTAL input clock frequency : 20 to 24MHz)) SW1-3 : ON (MD_BOOT2 = L) SW1-4 : OFF (MD_BOOT1 = H) SW1-5 : OFF (MD_BOOT0 = H) SW1-6 : ON (BSCANP normal mode (CoreSight debug mode)) SW1-7 : ON (CLKTEST OFF) SW1-8 : ON (TESTMD OFF) - JP1 : 1-2 (Setting to supply 3.3V power for PVcc_SPI of RZ/A2M and U2) - JP2 : 2-3 (Setting to supply 1.8V power for PVcc_HO of RZ/A2M and U3) - JP3 : Open (Use USB ch 0 in the function mode (Not supply VBUS0 power))
Set the DIP switches and jumpers of the SUB board as follows.
<<Setting for SUB board>> - SW6-1 : OFF (Setting to use P9_[7:0], P8_[7:1], P2_2, P2_0, P1_3, P1_[1:0], P0_[6:0], P6_7, P6_5, P7_[1:0] and P7[5:3] as DRP, audio, UART, CAN and USB interface terminals respectively) SW6-2 : ON (Setting to use P8_4, P8_[7:6], P6_4 and P9_[6:3] as DRP terminals) SW6-3 : OFF (Setting to use P9_[1:0], P1_0 and P7_5 as UART and USB interface terminals respectively) SW6-4 : OFF (Setting to use P6_[3:1] and PE_[6:0] as CEU terminals) SW6-5 : ON (Setting to use P3_[5:1], PH_5 and PK_[4:0] as Ethernet PHY2 terminals) SW6-6 : ON (Setting to use PJ_[7:6] as VDC6 terminals) SW6-7 : ON (Setting to use P7_[7:4] as VDC6 terminals) SW6-8 : OFF (NC) SW6-9 : OFF (P5_3 = "H") SW6-10 : OFF (PC_2 = "H")
- JP1 : 2-JP2 (Setting to use PJ_1 as interrupt terminal for IRQ0 switch (SW3))
Thank you for your support.
Now the RSPI function has been tested.
The problem encountered before was the wrong setting of SUB board SW6,
which has been resolved after your reminder.
So, thank you again.
Thank you for confirming that the issue is now solved. I'm going to close this thread now. If you have another issue or question, feel free to create another post. Have a nice day!
JBRenesasRulz Forum Moderator