Hey guys I am a new comer in this embedded era.So I need some support regarding code debugging. I am using embedded pi(stm32f103rbt6) board and keil tool. While debugging in some places of my code I am getting hard fault.
Generally it is coming after calling some function.If I am making parameters of that called function global(declaring and defining above to main()) then code is working fine.
But if those parameters definitions are inside main then its giving hard fault.
Can anyone suggest me how to resolve this issue.
Below I am providing main.c file
/** * Sample program that reads tags for a fixed period of time (500ms) * and prints the tags found. * @file read.c */ #include <tm_reader.h> #include <stdio.h> #include <stdlib.h> #include <stdarg.h> #include <string.h> #include <inttypes.h> //global declaration/definition TMR_Reader r, *rp; TMR_Status ret; TMR_ReadPlan plan; TMR_Region region; TMR_Region region ; uint8_t *antennaList = NULL; uint8_t antennaCount = 0x0; TMR_String model; char str[64]; int main(int argc, char *argv[]) { rp = &r; ret = TMR_create(rp, "tmr:///com1"); ret = TMR_connect(rp); region = TMR_REGION_NA; ret = TMR_paramSet(rp, TMR_PARAM_REGION_ID, ®ion); model.value = str; model.max = 64; TMR_paramGet(rp, TMR_PARAM_VERSION_MODEL, &model); if (((0 == strcmp("Sargas", model.value)) || (0 == strcmp("M6e Micro", model.value)) ||(0 == strcmp("M6e Nano", model.value))) && (NULL == antennaList)) { // fprintf(stdout, "Module doesn't has antenna detection support please provide antenna list\n"); // usage(); } /** * for antenna configuration we need two parameters * 1. antennaCount : specifies the no of antennas should * be included in the read plan, out of the provided antenna list. * 2. antennaList : specifies a list of antennas for the read plan. **/ // initialize the read plan ret = TMR_RP_init_simple(&plan, antennaCount, antennaList, TMR_TAG_PROTOCOL_GEN2, 1000); /* Commit read plan */ ret = TMR_paramSet(rp, TMR_PARAM_READ_PLAN, &plan); ret = TMR_read(rp, 500, NULL); if (TMR_ERROR_TAG_ID_BUFFER_FULL == ret) { /* In case of TAG ID Buffer Full, extract the tags present * in buffer. */ while (TMR_SUCCESS == TMR_hasMoreTags(rp)) { TMR_TagReadData trd; char epcStr[128]; char timeStr[128]; ret = TMR_getNextTag(rp, &trd); } TMR_destroy(rp); return 0; }
Thanks in advance. I am eagerly waiting for getting some positive solutions.
How about making the stack bigger?
Thanks a lot dear it worked.
I have one more question. Can you give some idea for How to create time function which provide some specific time delay?
Do we any other way also accept using timers/counters for creating delay function for specific time?
Is there any builts in time related functions for embedded pi(stm32f103tbr6) as like we have millis() in arduino.
Thanks again.