Hello,
I'm currently looking to utilize the INTMSPI0TX0 interrupt. I've added the ISR-related parameters call in the sample.oil file.Path: /whitebox-sdk/mcu/trampoline/examples/rh850/sample
ISR mspi_framend { CATEGORY = 2; //FSY unsupported PRIORITY = 1; SOURCE = frameend; //SysTick; }; ISR mspi_tx_int { CATEGORY = 2; //FSY unsupported PRIORITY = 1; SOURCE = MSPI0TXISR; //SysTick; }; TASK mspi_send { PRIORITY = 3; AUTOSTART = TRUE { APPMODE = std; }; ACTIVATION = 1; SCHEDULE = FULL; };
INTERRUPT iccomInt { ID = 80; }; INTERRUPT SysTick { ID = 364; }; INTERRUPT SysTick2 { ID = 365; }; INTERRUPT MSPI0TXISR { ID = 244; }; INTERRUPT frameend { ID = 252; };
ISR(mspi_tx_int) { debug_printf("MSPI mspi_tx_int\n\r"); R_Config_MSPI00_Callback_Interrupt_Send(); } ISR(mspi_framend) { debug_printf("MSPI mspi_framend\n\r"); R_Config_MSPI00_Callback_Interrupt_Send(); }
Hi Yen,
I think your modification is not wrong.
Following is my easy test.I don't have envrionemt which support for MSPI0TXISR so that I re-used iccom interrupt.I edited each file according you mentiond.Then, I swaped SOURCE variable of oil file between ISR mspi_tx_int and ISR_IccomInt* .
ISR mspi_tx_int { CATEGORY = 2; //FSY unsupported PRIORITY = 1; // SOURCE = MSPI0TXISR; //SysTick; SOURCE = iccomInt; };
After that, in my environtment, function which is called by interrupt can be changed.
root@s4sk-domd:~# iccom-testMSPI mspi_tx_int[ 163.273809] iccom e6260000.iccom00: [Err] Operation timed out[ 163.273887] iccom e6260000.iccom00: [Err] Initialization not Acked[Error] Initialization failed: unable to open /dev/iccom0G4MH is not running or doesn't reply message...
So, I think function will work correctly if you get interrupt correctly.
If you want more support from forum, please share more information.
I confirm that the interrupts have been triggered, with INTC2.EIC252.BIT.EIRF252 = 1 and INTC2.EIC244.BIT.EIRF244 = 1
How did you check interrupts has been triggered?After that, what function was called?
Hi Y.H,Let me first explain the situation of 'INTC2.EIC244.BIT.EIRF244 = 1'.I addde the 'MSPI_demo_init();' function to 'sample.c Fullscreen sample.c Download #include "tpl_os.h" #include "spider_serial.h" //#include "scp_RIIC/r_scp_riic.h" //#include "MSPI/MSPI_define.h" // #include "iodefine/initclock.h" extern void memory_unlocker(void); extern void iccom_init(void); extern int can_demo_init(void); extern int MSPI_demo_init(void); FUNC(int, OS_APPL_CODE) main(void) { iccom_init(); can_demo_init(); memory_unlocker(); Serial_Init(); // Serial_Init_SCIF(); debug_printf("*************************\n\r"); // debug_printf_115200("*************************\n\r"); init_RIIC(); MSPI_demo_init(); StartOS(OSDEFAULTAPPMODE); return 0; }
#include "tpl_os.h" #include "spider_serial.h" //#include "scp_RIIC/r_scp_riic.h" //#include "MSPI/MSPI_define.h" // #include "iodefine/initclock.h" extern void memory_unlocker(void); extern void iccom_init(void); extern int can_demo_init(void); extern int MSPI_demo_init(void); FUNC(int, OS_APPL_CODE) main(void) { iccom_init(); can_demo_init(); memory_unlocker(); Serial_Init(); // Serial_Init_SCIF(); debug_printf("*************************\n\r"); // debug_printf_115200("*************************\n\r"); init_RIIC(); MSPI_demo_init(); StartOS(OSDEFAULTAPPMODE); return 0; }
FUNC(int, OS_APPL_CODE) main(void) { iccom_init(); can_demo_init(); memory_unlocker(); Serial_Init(); debug_printf("*************************\n\r"); init_RIIC(); MSPI_demo_init(); // code add here StartOS(OSDEFAULTAPPMODE); return 0; }
Then I'll check if an interrupt has occurred with R_Config_MSPI00_Start();
#include <tpl_os.h> #include "MSPI/MSPI_define.h" extern volatile unsigned int g_mspi00_tx_data; /* mspi00 transmit data */ extern volatile unsigned int g_mspi00_tx_cnt; /* mspi00 transmit cnt */ void MSPI_demo_init(void) { R_Interrupt_Initialize_ForPE(); R_Config_MSPI00_Create(); debug_printf("MSPI config\n\r"); R_Config_MSPI00_Start(); // r_Config_MSPI00_disable_interrupt(); } TASK(mspi_send) { debug_printf("MSPI mspi_send\n\r"); R_Config_MSPI00_Start(); } ISR(mspi_tx_int) { debug_printf("MSPI mspi_tx_int\n\r"); R_Config_MSPI00_Callback_Interrupt_Send(); } ISR(mspi_framend) { debug_printf("MSPI mspi_framend\n\r"); R_Config_MSPI00_Callback_Interrupt_Frameend(); }
void MSPI_demo_init(void) { R_Interrupt_Initialize_ForPE(); R_Config_MSPI00_Create(); debug_printf("MSPI config\n\r"); R_Config_MSPI00_Start(); // check ISR flag // r_Config_MSPI00_disable_interrupt(); }
the console output will show:MSPI config1. INTC2.EIC244.BIT.EIRF244: 0x01. INTC2.EIC244.BIT.EIMK244: 0x01. MSPI0.CSTR0.UINT32: 0x232. INTC2.EIC244.BIT.EIRF244: 0x1Then the code will freeze before reaching sample.c -> StartOS(OSDEFAULTAPPMODE);If I enable 'r_Config_MSPI00_disable_interrupt();' in MSPI_demo.c,
it will forcibly clear the 'INTC2.EIC244.BIT.EIRF244' interrupt.The code will execute normally, including StartOS(OSDEFAULTAPPMODE); I moved 'MSPI_demo_init -> R_Config_MSPI00_Start' to TASK(mspi_send) for executionand add Interrupt number 244 on the config.oil filevoid MSPI_demo_init(void) { R_Interrupt_Initialize_ForPE(); R_Config_MSPI00_Create(); debug_printf("MSPI config\n\r"); // R_Config_MSPI00_Start(); // r_Config_MSPI00_disable_interrupt(); } TASK(mspi_send) { debug_printf("MSPI mspi_send\n\r"); R_Config_MSPI00_Start(); } ISR(mspi_tx_int) { debug_printf("MSPI mspi_tx_int\n\r"); R_Config_MSPI00_Callback_Interrupt_Send(); }The code will hang at R_Config_MSPI00_Start(). The other tasks are also not being executed.MSPI0.CSTS0.UINT32 = _MSPI_CHANNEL_SET_ACTIVE_FLAG | _MSPI_CHANNEL_SET_ENABLE_FLAG;void R_Config_MSPI00_Start(void) { /* Clear MSPI00 interrupt request and enable operation */ r_Config_MSPI00_enable_interrupt(); /* Enable MSPI0 channel 0 operation */ // MSPI0.CSTS0.UINT32 = _MSPI_CHANNEL_SET_ENABLE_FLAG; MSPI0.CSTS0.UINT32 = _MSPI_CHANNEL_SET_ACTIVE_FLAG | _MSPI_CHANNEL_SET_ENABLE_FLAG; //the code will hang on this line , debug_print is not print debug_printf("1. MSPI0.CSTR0.UINT32: 0x%X\n\r", MSPI0.CSTR0.UINT32); debug_printf("2. INTC2.EIC244.BIT.EIRF244: 0x%X\n\r", INTC2.EIC244.BIT.EIRF244); }
void MSPI_demo_init(void) { R_Interrupt_Initialize_ForPE(); R_Config_MSPI00_Create(); debug_printf("MSPI config\n\r"); // R_Config_MSPI00_Start(); // r_Config_MSPI00_disable_interrupt(); } TASK(mspi_send) { debug_printf("MSPI mspi_send\n\r"); R_Config_MSPI00_Start(); } ISR(mspi_tx_int) { debug_printf("MSPI mspi_tx_int\n\r"); R_Config_MSPI00_Callback_Interrupt_Send(); }
void R_Config_MSPI00_Start(void) { /* Clear MSPI00 interrupt request and enable operation */ r_Config_MSPI00_enable_interrupt(); /* Enable MSPI0 channel 0 operation */ // MSPI0.CSTS0.UINT32 = _MSPI_CHANNEL_SET_ENABLE_FLAG; MSPI0.CSTS0.UINT32 = _MSPI_CHANNEL_SET_ACTIVE_FLAG | _MSPI_CHANNEL_SET_ENABLE_FLAG; //the code will hang on this line , debug_print is not print debug_printf("1. MSPI0.CSTR0.UINT32: 0x%X\n\r", MSPI0.CSTR0.UINT32); debug_printf("2. INTC2.EIC244.BIT.EIRF244: 0x%X\n\r", INTC2.EIC244.BIT.EIRF244); }
#include "MSPI_define.h" #include <tpl_os.h> #define GPIO_GROUP4_BASE 0xFFD90000 #define IP2SR4 (*(volatile uint32_t *)(GPIO_GROUP4_BASE + 0x0068)) #define IP3SR4 (*(volatile uint32_t *)(GPIO_GROUP4_BASE + 0x006C)) #define PMMR4 (*(volatile uint32_t *)(GPIO_GROUP4_BASE + 0x0000)) #define GPSR4 (*(volatile uint32_t *)(GPIO_GROUP4_BASE + 0x0040)) // TODO make this value accessible globally #define PROTECTION_DISABLE_KEY 0xA5A5A501 // TODO make this value accessible globally #define PROTECTION_ENABLE_KEY 0xA5A5A500 volatile unsigned int g_mspi00_tx_num; /* mspi00 transmit data number */ volatile unsigned int g_mspi00_tx_frame_num; /* mspi00 transmit frame number */ volatile unsigned int *gp_mspi00_tx_address; /* mspi00 transmit buffer address */ volatile unsigned int g_mspi00_tx_data = 0; /* mspi00 transmit data */ volatile unsigned int g_mspi00_tx_cnt = 0; /* mspi00 transmit cnt */ void r_Config_MSPI00_callback_sendend(void); void r_Config_MSPI00_callback_error(uint32_t err_type); void init_MSPI0_clock(void); void config_port_setting(void); /*********************************************************************************************************************** * Function Name: R_Config_MSPI00_Create * Description : This function initializes the Config_MSPI00 module. * Arguments : None * Return Value : None ***********************************************************************************************************************/ void R_Config_MSPI00_Create(void) { init_MSPI0_clock(); config_port_setting(); /* Set MSPI0 control setting */ MSPI0.CTL1.UINT32 = _MSPI_CLOCK_DEFAULT_LOW | _MSPI_MSPISOUT_ENABLE_LOW_END_HOLD | _MSPI_CS7_SIGNAL_ACTIVE_LOW | _MSPI_CS6_SIGNAL_ACTIVE_LOW | _MSPI_CS5_SIGNAL_ACTIVE_LOW | _MSPI_CS4_SIGNAL_ACTIVE_LOW | _MSPI_CS3_SIGNAL_ACTIVE_LOW | _MSPI_CS2_SIGNAL_ACTIVE_LOW | _MSPI_CS1_SIGNAL_ACTIVE_HIGH | _MSPI_CS0_SIGNAL_ACTIVE_HIGH | _MSPI_MASTER_MODE | _MSPI_CS_SIGNAL_IGNORED | _MSPI_SAMPLE_STANDARD; debug_printf("MSPI0.CTL1.UINT32 = %X\n\r",MSPI0.CTL1.UINT32); MSPI0.CTL2.UINT32 = _MSPI_CONSISTENCY_DISABLE | _MSPI_LOOPBACK_DISABLE; /* Enable MSPI0 operation */ MSPI0.CTL0.UINT32 = _MSPI_FUNCTION_ENABLE; debug_printf("MSPI0.CTL0.UINT32 = %X\n\r",MSPI0.CTL0.UINT32); /* Set MSPI0 configuration setting */ MSPI0.CFG00.UINT32 = _MSPI_TRANSMISSION_ENABLE | _MSPI_RECEPTION_DISABLE | _MSPI_FIXED_FIFO_MEMORY_MODE | _MSPI_CHANNEL_PRIORITY_LEVEL8 | _MSPI_CHANNEL_LOCK_OPERATION_DISABLE | _MSPI_CHANNEL_OPERATION_END | _MSPI_INTMSPITX_INTERRUPT_ENABLE | _MSPI_INTMSPIRX_INTERRUPT_DISABLE | _MSPI_INTMSPIFE_INTERRUPT_ENABLE | _MSPI_INTMSPIERR_INTERRUPT_ENABLE; MSPI0.CFG01.UINT32 = _MSPI_SPCK_IDLE_LOW | _MSPI_SCK_PHASE_SHIFT_ODD_EDGES | _MSPI_COMMUNICATION_MSB | _MSPI_HOLD_ACTIVE_LEVEL | _MSPI_IDLE_TIME_NOT_INSERTED | _MSPI_CS_IDLE_LEVEL_INACTIVE | _MSPI_NO_CHECK; MSPI0.CFG02.UINT32 = _MSPI00_FRAME_LENGTH; MSPI0.CFG03.UINT32 = _MSPI_CLOCK_FREQUENCY_DIVISION_1 | _MSPI00_CLOCK_FREQUENCY_DIVISION; MSPI0.CFG04.UINT32 = _MSPI_FIFO_SIZE_32 | _MSPI00_HARDWARE_TRIGGER_DISABLE; MSPI0.RASTAD0.UINT32 = _MSPI00_RAMSTART_ADDRESS; MSPI0.SEUP0.UINT32 = _MSPI00_SETUP_TIME; MSPI0.HOLD0.UINT32 = _MSPI00_HOLD_TIME; MSPI0.IDLE0.UINT32 = _MSPI00_IDLE_TIME; MSPI0.INDA0.UINT32 = _MSPI00_INTER_DATA_TIME; MSPI0.CFSET0.UINT32 = _MSPI00_FRAME_COUNT; MSPI0.SSEL0.UINT32 = _MSPI_ACTIVATE_CS0 | _MSPI_DEACTIVATE_CS1 | _MSPI_DEACTIVATE_CS2 | _MSPI_DEACTIVATE_CS3 | _MSPI_DEACTIVATE_CS4 | _MSPI_DEACTIVATE_CS5 | _MSPI_DEACTIVATE_CS6 | _MSPI_DEACTIVATE_CS7; MSPITG.CTL0.UINT32 &= _MSPI_CHANNEL0_TRIGGER_SET_CLEAR; MSPITG.CTL0.UINT32 |= _MSPI_TRIGGER1_NONE_TRIGGER2_NONE; MSPITG.CTL0.UINT32 |= _MSPI_CHANNEL0_DMA_TRIGGER_ENABLE; MSPI0_INTF.MSPI0INTMSK0.UINT32 &= _MSPI_CHANNEL0_INTERRUPT_NOT_MASKED; MSPI0_INTF.MSPI0INTMSK3.UINT32 &= _MSPI_CHANNEL0_INTERRUPT_NOT_MASKED; MSPI0_INTF.MSPI0INTMSK2.UINT32 &= _MSPI_CHANNEL0_INTERRUPT_NOT_MASKED; /* Synchronization processing */ //g_cg_sync_read = MSPI0.CTL1.UINT32; __syncp(); //R_Config_MSPI00_Create_UserInit(); } void config_port_setting(void) { uint32_t tmp_value; uint32_t shift; PFC1.PMMER4_B0A0 = 0x00000001; /* func0 */ tmp_value = PFC1.GPSR4_B0A0 | 0x01F00000; PFC1.PMMR4_B0A0 = ~tmp_value; PFC1.GPSR4_B0A0 = tmp_value; debug_printf("PFC1.GPSR4_B0A0 = %X\n\r",PFC1.GPSR4_B0A0); /* PIN_SetPeriFun(0); //MSPI0SC */ shift = 16; tmp_value = (PFC1.IP2SR4_B0A0 & (uint32_t)(~(0xF << shift))) | (uint32_t)(0 << shift); PFC1.PMMR4_B0A0 = ~tmp_value; PFC1.IP2SR4_B0A0 = tmp_value; /* PIN_SetPeriFun(4); //MSPI0SI */ shift = 20; tmp_value = (PFC1.IP2SR4_B0A0 & (uint32_t)(~(0xF << shift))) | (uint32_t)(0 << shift); PFC1.PMMR4_B0A0 = ~tmp_value; PFC1.IP2SR4_B0A0 = tmp_value; /* PIN_SetPeriFun(0); //MSPI0SO/MSPI0DCS */ shift = 24; tmp_value = (PFC1.IP2SR4_B0A0 & (uint32_t)(~(0xF << shift))) | (uint32_t)(0 << shift); PFC1.PMMR4_B0A0 = ~tmp_value; PFC1.IP2SR4_B0A0 = tmp_value; /* PIN_SetPeriFun(4); //MSPI0CSS1 */ shift = 28; tmp_value = (PFC1.IP2SR4_B0A0 & (uint32_t)(~(0xF << shift))) | (uint32_t)(0 << shift); PFC1.PMMR4_B0A0 = ~tmp_value; PFC1.IP2SR4_B0A0 = tmp_value; debug_printf("PFC1.IP2SR4_B0A0 = %X\n\r",PFC1.IP2SR4_B0A0); /* PIN_SetPeriFun(4); //MSPI0CSS0 */ shift = 0; tmp_value = (PFC1.IP3SR4_B0A0 & (uint32_t)(~(0xF << shift))) | (uint32_t)(0 << shift); PFC1.PMMR4_B0A0 = ~tmp_value; PFC1.IP3SR4_B0A0 = tmp_value; debug_printf("PFC1.IP3SR4_B0A0 = %X\n\r",PFC1.IP3SR4_B0A0); tmp_value = PFC1.MODSEL4_B0A0 | 0x00000001; PFC1.PMMR4_B0A0 = ~tmp_value; PFC1.MODSEL4_B0A0 = tmp_value; debug_printf("PFC1.MODSEL4_B0A0 = %X\n\r",PFC1.MODSEL4_B0A0); // Set the drive strength to 7/8 tmp_value = PFC1.DRV2CTRL4_B0A0 & ~0xFFF00000; tmp_value |= 0x33300000; PFC1.PMMR4_B0A0 = ~tmp_value; PFC1.DRV2CTRL4_B0A0 = tmp_value; debug_printf("PFC1.DRV2CTRL4_B0A0 = %X\n\r",PFC1.DRV2CTRL4_B0A0); // Set the drive strength to 7/8 tmp_value = PFC1.DRV3CTRL4_B0A0 & ~0x0000000F; tmp_value |= 0x00000003; PFC1.PMMR4_B0A0 = ~tmp_value; PFC1.DRV3CTRL4_B0A0 = tmp_value; debug_printf("PFC1.DRV3CTRL4_B0A0 = %X\n\r",PFC1.DRV3CTRL4_B0A0); } void init_MSPI0_clock(void) { uint32_t val; SYSCTRL.CLKKCPROT1.UINT32 = PROTECTION_DISABLE_KEY; // Allow access to the clock controller registers SYSCTRL.CLKD_PLLC.UINT32 = 0x00000001; // Make sure the PLL output clock is not divided while (!SYSCTRL.CLKD_PLLS.BIT.PLLCLKDSYNC); SYSCTRL.CKSC_CPUC.UINT32 = 0; // Select the PLL output as the source for the system clock while (SYSCTRL.CKSC_CPUS.BIT.CPUCLKSACT); SYSCTRL.CKSC_MSPIC.UINT32 = 0x00000001; // Make sure the clock is not divided SYSCTRL.CLKKCPROT1.UINT32 = PROTECTION_ENABLE_KEY; // Re-enable the clock controller registers protection // Allow access to the standby controller registers SYSCTRL.STBCKCPROT.UINT32 = PROTECTION_DISABLE_KEY; SYSCTRL.MSRKCPROT.UINT32 = PROTECTION_DISABLE_KEY; // Enable the MSPI0 clock val = SYSCTRL.MSR_MSPI.UINT32; debug_printf("init_MSPI0_clock 1\n\r"); debug_printf("%X\n\r",val); val &= 0xFE; SYSCTRL.MSR_MSPI.UINT32 = val; val = SYSCTRL.MSR_MSPI.UINT32; debug_printf("init_MSPI0_clock 2\n\r"); debug_printf("%X\n\r",val); } /*********************************************************************************************************************** * Function Name: r_Config_MSPI00_enable_interrupt * Description : This function enables interrupt operation. * Arguments : None * Return Value : None ***********************************************************************************************************************/ void r_Config_MSPI00_enable_interrupt(void) { INTC2.EIC244.BIT.EIRF244 = _INT_REQUEST_NOT_OCCUR; INTC2.EIC244.BIT.EIMK244 = _INT_PROCESSING_ENABLED; debug_printf("1. INTC2.EIC244.BIT.EIRF244: 0x%X\n\r", INTC2.EIC244.BIT.EIRF244); debug_printf("1. INTC2.EIC244.BIT.EIMK244: 0x%X\n\r", INTC2.EIC244.BIT.EIMK244); } void r_Config_MSPI00_enable_interrupt_252(void) { INTC2.EIC252.BIT.EIRF252 = _INT_REQUEST_NOT_OCCUR; INTC2.EIC252.BIT.EIMK252 = _INT_PROCESSING_ENABLED; debug_printf("1. INTC2.EIC252.BIT.EIRF252: 0x%X\n\r", INTC2.EIC252.BIT.EIRF252); debug_printf("1. INTC2.EIC252.BIT.EIMK252: 0x%X\n\r", INTC2.EIC252.BIT.EIMK252); } /*********************************************************************************************************************** * Function Name: r_Config_MSPI00_disable_interrupt * Description : This function disables interrupt operation. * Arguments : None * Return Value : None ***********************************************************************************************************************/ void r_Config_MSPI00_disable_interrupt(void) { INTC2.EIC244.BIT.EIMK244 = _INT_PROCESSING_DISABLED; INTC2.EIC244.BIT.EIRF244 = _INT_REQUEST_NOT_OCCUR; } /*********************************************************************************************************************** * Function Name: R_Config_MSPI00_Start * Description : This function starts the Config_MSPI00 module operation. * Arguments : None * Return Value : None ***********************************************************************************************************************/ void R_Config_MSPI00_Start(void) { /* Clear MSPI00 interrupt request and enable operation */ r_Config_MSPI00_enable_interrupt(); /* Enable MSPI0 channel 0 operation */ // MSPI0.CSTS0.UINT32 = _MSPI_CHANNEL_SET_ENABLE_FLAG; MSPI0.CSTS0.UINT32 = _MSPI_CHANNEL_SET_ACTIVE_FLAG | _MSPI_CHANNEL_SET_ENABLE_FLAG; debug_printf("1. MSPI0.CSTR0.UINT32: 0x%X\n\r", MSPI0.CSTR0.UINT32); debug_printf("2. INTC2.EIC244.BIT.EIRF244: 0x%X\n\r", INTC2.EIC244.BIT.EIRF244); } /*********************************************************************************************************************** * Function Name: R_Config_MSPI00_Stop * Description : This function stops the MSPI0 module operation. * Arguments : None * Return Value : None ***********************************************************************************************************************/ void R_Config_MSPI00_Stop(void) { /* Disable MSPI0 channel 0 operation */ MSPI0.CSTC0.UINT32 = _MSPI_CHANNEL_CLEAR_ENABLE_FLAG; /* Disable MSPI00 interrupt operation and clear request */ r_Config_MSPI00_disable_interrupt(); /* Synchronization processing */ // g_cg_sync_read = MSPI0.CTL0.UINT8; __syncp(); } /*********************************************************************************************************************** * Function Name: R_Config_MSPI00_Send * Description : This function sends MSPI0 data. * Arguments : tx_buf - * send buffer pointer * Return Value : MD_STATUS - * the status of sending ***********************************************************************************************************************/ uint32_t R_Config_MSPI00_Send(uint32_t* const tx_buf) { /* Set transmit setting */ gp_mspi00_tx_address = (uint32_t *)tx_buf; g_mspi00_tx_num = 10; g_mspi00_tx_frame_num = 10; while(g_mspi00_tx_num>0) { debug_printf("*gp_mspi00_tx_address: 0x%X\n\r",*gp_mspi00_tx_address); debug_printf("gp_mspi00_tx_address: 0x%X\n\r",gp_mspi00_tx_address); debug_printf("g_mspi00_tx_num: 0x%X\n\r",g_mspi00_tx_num); gp_mspi00_tx_address++; g_mspi00_tx_num--; } gp_mspi00_tx_address = (uint32_t *)tx_buf; g_mspi00_tx_num = 10; g_mspi00_tx_frame_num = 10; return 0; } /*********************************************************************************************************************** * Function Name: R_Config_MSPI00_Software_Trigger * Description : This function sets software trigger. * Arguments : None * Return Value : None ***********************************************************************************************************************/ void R_Config_MSPI00_Software_Trigger() { MSPI0.CSTS0.UINT32 = _MSPI_CHANNEL_SET_ACTIVE_FLAG | _MSPI_CHANNEL_SET_ENABLE_FLAG; // debug_printf("MSPI0.CSTR0.UINT32: 0x%X\n\r", MSPI0.CSTR0.UINT32); } /*********************************************************************************************************************** * Function Name: R_Config_MSPI00_Callback_Interrupt_Send * Description : This function is MSPI0 send interrupt service routine. * Arguments : None * Return Value : None ***********************************************************************************************************************/ void R_Config_MSPI00_Callback_Interrupt_Send(void) { uint16_t count = 0U; uint32_t temp_intmsk = 0U; temp_intmsk = MSPI0_INTF.MSPI0INTMSK0.UINT32; MSPI0_INTF.MSPI0INTMSK0.UINT32 = _MSPI_ALL_CHANNELS_INTERRUPT_MASKED; if ((MSPI0_INTF.MSPI0INTF0.UINT32 & _MSPI_CHANNEL0_INTERRUPT_OCCURRED) != 0U) { MSPI0_INTF.MSPI0INTFC0.UINT32 = _MSPI_CHANNEL0_INTERRUPT_FLAG_CLEAR; // Send half of the FIFO's data if(g_mspi00_tx_cnt == 1) { MSPI0.TXDA00.UINT32 = g_mspi00_tx_data; debug_printf("MSPI0.TXDA00.UINT32: 0x%X\n\r",MSPI0.TXDA00.UINT32); g_mspi00_tx_cnt = 0; } } MSPI0_INTF.MSPI0INTMSK0.UINT32 = temp_intmsk; } void R_Config_MSPI00_Callback_Interrupt_Error(void) { uint32_t err_type = 0U; uint32_t temp_intmsk = 0U; temp_intmsk = MSPI0_INTF.MSPI0INTMSK3.UINT32; MSPI0_INTF.MSPI0INTMSK3.UINT32 = _MSPI_ALL_CHANNELS_INTERRUPT_MASKED; if ((MSPI0_INTF.MSPI0INTF3.UINT32 & _MSPI_CHANNEL0_INTERRUPT_OCCURRED) != 0U) { MSPI0_INTF.MSPI0INTFC3.UINT32 = _MSPI_CHANNEL0_INTERRUPT_FLAG_CLEAR; err_type = (MSPI0.CEST0.UINT32 & (_MSPI_CHANNEL_CONSISTENCY_ERROR_DETECTED | _MSPI_CHANNEL_CRC_ERROR_DETECTED | _MSPI_CHANNEL_PARITY_ERROR_DETECTED | _MSPI_CHANNEL_OVER_READ_ERROR_DETECTED | _MSPI_CHANNEL_OVER_WRITE_ERROR_DETECTED | _MSPI_CHANNEL_OVER_RUN_ERROR_DETECTED)); MSPI0.CESTC0.UINT32 |= (_MSPI_CHANNEL_CONSISTENCY_ERROR_CLEAR | _MSPI_CHANNEL_CRC_ERROR_CLEAR | _MSPI_CHANNEL_PARITY_ERROR_CLEAR | _MSPI_CHANNEL_OVER_READ_ERROR_CLEAR | _MSPI_CHANNEL_OVER_WRITE_ERROR_CLEAR | _MSPI_CHANNEL_OVER_RUN_ERROR_CLEAR); if (err_type != 0U) { r_Config_MSPI00_callback_error(err_type); } } MSPI0_INTF.MSPI0INTMSK3.UINT32 = temp_intmsk; } void R_Config_MSPI00_Callback_Interrupt_Frameend(void) { uint32_t temp_intmsk = 0U; temp_intmsk = MSPI0_INTF.MSPI0INTMSK2.UINT32; MSPI0_INTF.MSPI0INTMSK2.UINT32 = _MSPI_ALL_CHANNELS_INTERRUPT_MASKED; if ((MSPI0_INTF.MSPI0INTF2.UINT32 & _MSPI_CHANNEL0_INTERRUPT_OCCURRED) != 0U) { MSPI0_INTF.MSPI0INTFC2.UINT32 = _MSPI_CHANNEL0_INTERRUPT_FLAG_CLEAR; r_Config_MSPI00_callback_sendend(); /* Start user code for R_Config_MSPI00_Callback_Interrupt_Frameend. Do not edit comment generated here */ /* End user code. Do not edit comment generated here */ } MSPI0_INTF.MSPI0INTMSK2.UINT32 = temp_intmsk; } void r_Config_MSPI00_callback_error(uint32_t err_type) { /* Start user code for r_Config_MSPI00_callback_error. Do not edit comment generated here */ debug_printf("r_Config_MSPI00_callback_error\n\r"); /* End user code. Do not edit comment generated here */ } void R_Interrupt_Initialize_ForPE(void) { /* Set INTMSPI0ERR setting */ INTC2.EIC253.BIT.EIMK253 = _INT_PROCESSING_DISABLED; INTC2.EIC253.BIT.EIRF253 = _INT_REQUEST_NOT_OCCUR; INTC2.EIC253.BIT.EITB253 = _INT_TABLE_VECTOR; INTC2.EIC253.UINT16 &= _INT_PRIORITY_LOWEST; INTC2.EIBD253.BIT.PEID = _INT_CPU_PE0; /* Set INTMSPI0FE setting */ INTC2.EIC252.BIT.EIMK252 = _INT_PROCESSING_DISABLED; INTC2.EIC252.BIT.EIRF252 = _INT_REQUEST_NOT_OCCUR; INTC2.EIC252.BIT.EITB252 = _INT_TABLE_VECTOR; INTC2.EIC252.UINT16 &= _INT_PRIORITY_LOWEST; INTC2.EIBD252.BIT.PEID = _INT_CPU_PE0; /* Set INTMSPI0TX setting */ INTC2.EIC250.BIT.EIMK250 = _INT_PROCESSING_DISABLED; INTC2.EIC250.BIT.EIRF250 = _INT_REQUEST_NOT_OCCUR; INTC2.EIC250.BIT.EITB250 = _INT_TABLE_VECTOR; INTC2.EIC250.UINT16 &= _INT_PRIORITY_LOWEST; INTC2.EIBD250.BIT.PEID = _INT_CPU_PE0; /* Set INTMSPI0TX0 setting */ INTC2.EIC244.BIT.EIMK244 = _INT_PROCESSING_DISABLED; INTC2.EIC244.BIT.EIRF244 = _INT_REQUEST_NOT_OCCUR; INTC2.EIC244.BIT.EITB244 = _INT_TABLE_VECTOR; INTC2.EIC244.UINT16 &= _INT_PRIORITY_LOWEST; INTC2.EIBD244.BIT.PEID = _INT_CPU_PE0; }
Next, let me explain INTC2.EIC252.BIT.EIRF252 = 1.I have written a function for controlling MSPI TX by software, but it is not yet controlled by interrupt 252.
TASK(mspi_send) { uint32_t tx_buffer[10]={1, 2, 3, 4, 5, 6, 7, 8, 9, 10}; uint32_t i; debug_printf("MSPI send\n\r"); // r_Config_MSPI00_enable_interrupt_252(); for(i=0; i<=9; i++) { if(g_mspi00_tx_cnt == 0) { R_Config_MSPI00_Software_Trigger(); g_mspi00_tx_data = tx_buffer[i]; g_mspi00_tx_cnt = 1; // software trigger R_Config_MSPI00_Callback_Interrupt_Send(); } } R_Config_MSPI00_Callback_Interrupt_Frameend(); TerminateTask(); }
However, if I switch control to Interrupt 252, a situation similar to Interrupt 244 might occur, causing other tasks to halt. Yet, I've added the declaration for Interrupt 252 in config.oil.
TASK(mspi_send) { uint32_t tx_buffer[10]={1, 2, 3, 4, 5, 6, 7, 8, 9, 10}; uint32_t i; debug_printf("MSPI send\n\r"); r_Config_MSPI00_enable_interrupt_252(); for(i=0; i<=9; i++) { if(g_mspi00_tx_cnt == 0) { R_Config_MSPI00_Software_Trigger(); g_mspi00_tx_data = tx_buffer[i]; g_mspi00_tx_cnt = 1; // software trigger R_Config_MSPI00_Callback_Interrupt_Send(); } } // R_Config_MSPI00_Callback_Interrupt_Frameend(); TerminateTask(); } ISR(mspi_framend) { debug_printf("MSPI mspi_framend\n\r"); R_Config_MSPI00_Callback_Interrupt_Frameend(); }
#include <tpl_os.h> #include "MSPI/MSPI_define.h" extern volatile unsigned int g_mspi00_tx_data; /* mspi00 transmit data */ extern volatile unsigned int g_mspi00_tx_cnt; /* mspi00 transmit cnt */ void MSPI_demo_init(void) { R_Interrupt_Initialize_ForPE(); R_Config_MSPI00_Create(); debug_printf("MSPI config\n\r"); // R_Config_MSPI00_Start(); // r_Config_MSPI00_disable_interrupt(); } TASK(mspi_send) { uint32_t tx_buffer[10]={1, 2, 3, 4, 5, 6, 7, 8, 9, 10}; uint32_t i; debug_printf("MSPI send\n\r"); // r_Config_MSPI00_enable_interrupt_252(); for(i=0; i<=9; i++) { if(g_mspi00_tx_cnt == 0) { R_Config_MSPI00_Software_Trigger(); g_mspi00_tx_data = tx_buffer[i]; g_mspi00_tx_cnt = 1; // software trigger R_Config_MSPI00_Callback_Interrupt_Send(); } } // R_Config_MSPI00_Callback_Interrupt_Frameend(); TerminateTask(); } ISR(mspi_tx_int) { debug_printf("MSPI mspi_tx_int\n\r"); R_Config_MSPI00_Callback_Interrupt_Send(); } ISR(mspi_framend) { debug_printf("MSPI mspi_framend\n\r"); R_Config_MSPI00_Callback_Interrupt_Frameend(); }
When interruptions occur at 244 or 252 interruptions, I noticed that the following code segment in \whitebox-sdk\mcu\trampoline\machines\rh850\renesas_irq.c does not execute.
>When interruptions occur at 244 or 252 interruptions,>I noticed that the following code segment in>\whitebox-sdk\mcu\trampoline\machines\rh850\renesas_irq.c>does not execute.Table interrupt mode is set in MSPI.c. Have you changed the settings in Trampoline? It seems that you need to change the settings for using table reference method in trampoline/machines/rh850/tpl_startup.asm. Please review these settings.Please note that R-Car S4 Whitebox SDK team has not confirmed the operation other than in direct vector mode.
I'm sorry, we cannot continue to discuss your question in this forum. Because your question may include proprietary Infomation(e.g. User's Manual, Source Code, Hardware design, etc).
We can discuss questions based on public information about R-Car S4 Starter Kit and R-Car S4 Whitebox SDK in this forum. Let me share a case study that you can post as follows: - The contents of being described in R-Car S4 Whitebox SDK User’s Manual, Application Note and Demonstration Startup Guide.(Spider/Starter Kit + R-Car S4 Whitebox SDK) - Information that anyone can see or know, such as information already posted on the website or GitHub.
Thus, if you want to get support about questions including proprietary Infomation, please contact your contact person or renesas official support.official support: https://www.renesas.com/support
So I will close this ticket. If you can post question without non-public information, please submit new question.
Hi Y.H,
I've identified the issue.
My declaration was using the Table Reference Method, but I switched it to the Direct Vector Method.
Now, I can smoothly enter the interrupt. Thank you very much for your help.
Please close this ticket.
Yen