Closed omidk94 closed 4 years ago
Hello. Please check your rx buffer. I think your mcu can not get correct character
but in debug mode, I can check all of the chars that MCU received from simcom module, and it's ok, do you have any idea?
Incrase your rtos heap and try again. After init , 2 task must be crated.
Dear Nima, in fact, the task can create cause the MCU can send at-command to simcom module, but it can't understand the simcom response, my simcom module is sim808 and it's on sim80x series. if the RTOS heap is low the MCU should go to hard fault error, is it true? but I don't have this problem. may I upload my code and you see it, please?
Best regards, Omid
`void Sim80x_Init(osPriority Priority) {
HAL_GPIO_WritePin(_SIM80X_POWER_KEY_GPIO,_SIM80X_POWER_KEY_PIN,GPIO_PIN_SET);
osDelay(1000);
memset(&Sim80x,0,sizeof(Sim80x));
memset(Sim80x.UsartRxBuffer,0,_SIM80X_BUFFER_SIZE);
HAL_UART_Receive_IT(&_SIM80X_USART,&Sim80x.UsartRxTemp,1);
osThreadDef(Sim80xTask, StartSim80xTask, Priority, 0, 256);
Sim80xTaskHandle = osThreadCreate(osThread(Sim80xTask), NULL);
osThreadDef(Sim80xBuffTask, StartSim80xBuffTask, Priority, 0, 256);
Sim80xBuffTaskHandle = osThreadCreate(osThread(Sim80xBuffTask), NULL);
for(uint8_t i=0 ;i<10 ;i++)
{
printf("%s\n", Sim80x.UsartRxBuffer);
if(Sim80x_SendAtCommand("AT\r\n",200,1,"AT\r\r\nOK\r\n") == 1)
break;
osDelay(200);
}
Sim80x_SetPower(true);
}`
I just add printf in Sim80x_Init function for finding the answer, and it returns this :
ATT ATTATT ATTATTATT ATTATTATTATT ATTATTATTATTATT ATTATTATTATTATTATT ATTATTATTATTATTATTATT ATTATTATTATTATTATTATTATT
You do a test after increasing the memory
I increase the heap size to 4096 bytes but the issue is same, can you please check my code? https://drive.google.com/file/d/1b17LG8e0bS6cb-xn33oa8vSUPPtm0nQB/view?usp=sharing thank you,
Dear Nima,
thanks for your help, my code issue is on another function, I didn't call:
void HAL_UART_RxCpltCallback(UART_HandleTypeDef *huart) { Sim80x_RxCallBack(); } on my code and increase the heap to 16K and then everything works well,
thank you for your help, Best Regards, Omid
Dear nimaLtd,
thank you so much for your best lib for sim800 modules, I have some problem with Sim80x_SendAtCommand function, this function just returns false in all-time although the simcom module returns true answer and the MCU will go to UART interrupt routine and then called Sim80x_RxCallBack(),
but the SIM80x_SendAtCommand returned false value ,
can you help me, please? or send some better examples, please?
thank you so much Best Regards Omid.K