Set Token not applied after unlock token

Hi,

I am currently testing token for Angaza keycode full size. But I am facing issues in application of Set token.

  1. Generated unlock token, applied unlock token. Device unlocked
  2. Generated set token of 0 hour credit, applied token. Device still unlocked not shifted to 0 credit.
  3. Disconnected battery , connected battery and applied set token . Now token applied and credit 0 hours.

I tried to use set token of different hours also still same result. Unable to apply set token after unlock until device is disconnected from battery and reconnected.

Mansi,

Here is the source code of the Nexus Keycode library for processing unlock and set credit = 0 keycodes. As you can see, the code is very similar for both. If you are able to reset the device and get the result of the last set credit keycode that you entered, then this means that the Nexus Keycode library did its job: it decoded the keycode and called nxp_keycode_payg_credit_set with the correct argument.

It sounds like the problem is in the way that your code updates its PAYG state. Are there differences in the way that you have implemented nxp_keycode_payg_credit_unlock and nxp_keycode_payg_credit_set? Maybe there is a difference in the way that the credit is updated in your RAM.

Device still unlocked not shifted to 0 credit.

What is the function on your side that is called when you are checking the PAYG credit to get the above result? Maybe this function is not being called to refresh the PAYG state value when you check it on the device display.

I tried to use set token of different hours also still same result.

Can you use set credit after add credit or other set credit successfully, or does the problem only occur when using set credit after unlock? This could give another hint to the source of the problem.

Thanks,

Eric

Hi Eric,

We have used update_payg_state from payg_state.c as given in example implementation to update paygstate.

I will check how can we debug these files to get idea about set and unlock state update.

I can implement set credit after add credit or as first token too. Issue only occurs after unlock credit.

For set token after unlock.
nxp_keycode_feedback_start is not called. Seems like keycode is not processed correctly in nx_keycode_handle_complete_keycode

Mansi,

nxp_keycode_feedback_start is not called. Seems like keycode is not processed correctly in nx_keycode_handle_complete_keycode

Can you debug your code to find out what exactly is happening? In our sample program, it is possible to set credit to 0 after unlock without resetting the device. So I don’t understand how the keycode could be processed incorrectly in nx_keycode_handle_complete_keycode.

Maybe you can check the state of the rest of your program and see if anything else changes before and after the reset.

Eric

@mansi
Are you sure you are using a different message ID for your generated set token?
Also are you storing NX_NV_BLOCK_KEYCODE_PRO block, somewhere in your flash?

What you can try also, is to generate a wipe all token. It will reset the masks and set credit to 0 as well.

Yes I am generating set token using different msg ID.
No I am not storing NX_NV_BLOCK_KEYCODE_PRO in flash.

After I put Unlock token nexus_keycode_mas_process & nexus_keycode_pro_process are not called. Even though these should be continuously processed.

@mansi
Are you using the function nx_keycode_handle_complete_keycode to handle your key code?
Normally the library will process the key automatically, because the key code will be added to the queue and processed (nexus_keycode_pro_enqueue)

Probably you are missing the implementation of the user function nxp_common_request_processing in which you can call nx_common_process in order to process immediately your key code.

For information, the periodic call of nx_common_process is mainly used to update the grace period.

Yes nx_keycode_handle_complete_keycode is automatically called in keyboard_process_keycode