This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

why the INVALID_STATE error code appear???And how to solve??

Hi all,

In my keyboard application, I found sometimes it return the INVALID_STATE error code , when called keys_send() , once this error code appeared, no others return by keys_send() again.
But the connection state is always CONNECTED, both in device side and the host side (it displays CONNECTED in the host side).
I want to know:

1.why will it happen while CONNECTED? 2.what could I do to excute the keys_send() correctly?

Thanks a lot.

Jim

Parents
  • That would seem to indicate that you are running out of memory. Since it is occurring on a operation on a timer rather than creation of a timer, you need to increase your timer queue size by changing the define APP_TIMER_OP_QUEUE_SIZE to be larger.

  • I believe APP_TIMER_OP_QUEUE_SIZE is only limited by the amount of free RAM you have to store the queue. I don't know if there really is a direct relationship between the number of timers vs the size of the queue. It really is going to depend on how your application is designed. If you only have a couple of timer operations going at the same time you may get away with a smaller queue size than if you are performing operations on all of your timers nearly simultaneously.

    Take a look at APP_TIMER_INIT in app_timer.h, and spend some time looking at app_timer.c if you want to get more familiar with how the timers work.

Reply
  • I believe APP_TIMER_OP_QUEUE_SIZE is only limited by the amount of free RAM you have to store the queue. I don't know if there really is a direct relationship between the number of timers vs the size of the queue. It really is going to depend on how your application is designed. If you only have a couple of timer operations going at the same time you may get away with a smaller queue size than if you are performing operations on all of your timers nearly simultaneously.

    Take a look at APP_TIMER_INIT in app_timer.h, and spend some time looking at app_timer.c if you want to get more familiar with how the timers work.

Children
No Data
Related