hello everybody,
I have some problems with using MQX4.2, my program is often stuck in the following code in idletask.c
"
while (1) {
#if !defined(MQX_ENABLE_IDLE_LOOP) || MQX_ENABLE_IDLE_LOOP
if (++kernel_data->IDLE_LOOP.IDLE_LOOP1 == 0) {
if (++kernel_data->IDLE_LOOP.IDLE_LOOP2 == 0) {
if (++kernel_data->IDLE_LOOP.IDLE_LOOP3 == 0) {
++kernel_data->IDLE_LOOP.IDLE_LOOP4;
}
}
}
#endif /* !defined(MQX_ENABLE_IDLE_LOOP) || MQX_ENABLE_IDLE_LOOP */
"
it looks like the task scheduling problems, but when I only have one main_task, and then I was in the debug I2C
it was stuck there, could anybody know what's the problem?
Hi,
Are you using a custom board? I've seeing this issue when the board has a hardware problems for example bad clock configurations or bad jumper configuration.
Are you using interrupts??
Could you please share the code in order to reproduce the issue?
Have a great day,
Sol
-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------
Hello, my application will not be stuck in there by now, but the question is the I2C waveform is always the same now,when I used the function of I2C_DRV_MasterSendDataBlocking (chan, & device, NULL, 0, pdata, 1, 200); no matter how do I change the value of the pdata,the waveform of I2C was same,the SDA line only have the start and stop bits, middle of it was full of zero
I think the board is no problem, I have try the custom board of frdmk64f and my own board, there have the same problem In MQX4.2 with KSDK1.2 on kds3.0
my code is below,did I have some wrong with it,and when I use the example of "i2c_blocking_master_example_frdmk64f",the waveform is same,I don't know what's wrong with it
Oscilloscope test out the waveform as shown, when I change the value sent about pdata,the wave is same as the photo
void main_task( task_param_t init_data ){
_task_id rx_tid;
_task_id tx_tid;
TASK_PARAMS task_p = {0};
uint8_t result = 0;
uint8_t temp;
hardware_init();
OSA_Init();
button_init();
i2c_init(0);
uint8_t i;
uint8_t length = 10;
uint8_t data[length];
for(i = 0;i<length;i++){
data[i] = i;
}
while(1){
i2c_sendbuf(0,data,length);
_time_delay(5);
};
}
_WEAK_FUNCTION(void hardware_init(void)) {
uint8_t i;
/* enable clock for PORTs */
for (i = 0; i < PORT_INSTANCE_COUNT; i++)
{
CLOCK_SYS_EnablePortClock(i);
}
/* Init board clock */
BOARD_ClockInit();
/* In case IO sub is turned off, dbg console should be used for printing */
#if !BSPCFG_ENABLE_IO_SUBSYSTEM
dbg_uart_init(); //wangyufei
#endif
}
void i2c_init(uint8_t chan){
uint32_t i = 0;
// i2c master state
i2c_master_state_t master;
// i2c device configuration
configure_i2c_pins(0);
configure_i2c_pins(1);
// Initialize i2c master
I2C_DRV_MasterInit(0, &master);
I2C_DRV_MasterInit(1, &master);
}
int i2c_sendbuf(uint8_t chan,uint8_t *data,uint8_t length)
{
uint32_t i = 0;
i2c_status_t status1;
uint8_t pdata[10];
for(i = 0; i < DATA_LENGTH; i++)
{
txBuff[i] = i + 1;
}
uint8_t result;
for(i = 0;i<10;i++)
pdata[i] = i+3;
pdata[0] = 0x80;
pdata[1] = 0xF3;
result = I2C_DRV_MasterSendDataBlocking(chan, &device,
pdata, 1,pdata, 2, 200);
// Delay to wait slave received data
OSA_TimeDelay(10);
// _time_delay(5);
pdata[0] = 0x81;
result = I2C_DRV_MasterSendDataBlocking(chan, &device,
pdata, 1,pdata, 1, 200);
// Clear rxBuff
for(i = 0; i < count; i++)
{
rxBuff[i] = 0;
}
// Master receives count byte data from slave
result = I2C_DRV_MasterReceiveDataBlocking(chan, &device,
NULL, 0, rxBuff, 1, 200);
OSA_TimeDelay(5);
}