NXP NFC Advanced Reader Queue

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

NXP NFC Advanced Reader Queue

1,167 Views
berndbogenriede
Contributor I

Hello Community,

since a few weeks i am stuck with an example of the NXP NFC Reader Library.

I am using the Advanced Discovery Loop Example Code. There is a FreeRTOS System underlying. In my second Thread of the freeRTOS System i have set some control Bits for the Discovery Loop. My Problem is to pass the information to the the first process.

It would be nice if i could use the queue function of the FreeRTOS, but when i try to receive the sent information i only get very weird values. For example when i sent from the second process a 3 through a uint8_t variable, i get a 82 in the other process.

The handle is right because i get the right amount of stored Datas in the queue and also can receive the right value in the same process. Only when i try to access the data from another process i get wrong values.

Does anyone know what the problem is when i try to pass the Data to an other process?

My hardware is the eval Board OM25180.

Best regards

Bernd

0 Kudos
6 Replies

795 Views
berndbogenriede
Contributor I

Hey Kan,

to use xQueueCreateStatic() would be eventually a solution because something in the usb interrupt is overwriting the memory. But in my opinion a static is no solution, so i need to find the bad function who causes this data lost.

Before the Scheduler Started i sent 4 to the queue, we can see it at adress 0x10007FBC

pastedImage_2.png

After the USB Interrupt, something has overwritten this adress.

pastedImage_1.png

0 Kudos

795 Views
berndbogenriede
Contributor I

Thank you for your reply, i do not know if i can post my whole code, because it es part of a bigger project.

but i found out that the USB HID Device is the problem.

In one of my processes i have the Generic USB HID Example of the LPC1769. When it enables the IRQ my queue loses all the information, But the amount of available Stack elements is still right. When i erase line 165, i have no problem to transmit data through the queue, but then i cannot connect the USB Device.

pastedImage_2.png

I am creating the queue before the Taskscheduler and calling it from the USB ISR and a few other Processes.

Update 08.03.18 - 8.21:

The problem accurs when i try to send information from a task to the usb interrupt. Sending from the interrupt to another process is no problem

0 Kudos

795 Views
Kan_Li
NXP TechSupport
NXP TechSupport

Hi Bernd,

It sounds more like a FreeRTOS issue than a NFC issue, so maybe it is not the right place for this topic, but I am still trying to help.

Though I didn't have the source code of USB_ISR, but referring to https://www.freertos.org/Documentation/FreeRTOS_Reference_Manual_V10.0.0.pdf , it recommends xQueueSendToBackFromISR() and xQueueReceiveFromISR() for ISR queue operation, I guess you used xQueueSend() and xQueueReceive() instead, the reason for "The problem accurs when i try to send information from a task to the usb interrupt. Sending from the interrupt to another process is no problem" is due to the following statement:

"A version of xQueueReceive() that can be called from an ISR." page 189 of FreeRTOS_Reference_Manual_V10.0.0.

"Versions of the xQueueSend(), xQueueSendToFront() and xQueueSendToBack() API functions that can be called from an ISR." page 202 of FreeRTOS_Reference_Manual_V10.0.0.

Please kindly check on your side.

Hope that helps,


Have a great day,
Kan

-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------

0 Kudos

795 Views
berndbogenriede
Contributor I

Hey Kan,

thank you very much for the fast reply. I supposed that it is not a problem with the nfc, but the freeRTOS is implemented in the nfc example. This is the reason  why I have called the NFC forum, maybe i should replace it into a FreeRTOS topic.

I had already implemented xQueueReceiveFromISR() in my functions but it does not change anything. I think this special function are needed for interrupting another task, but my problem starts during the startup of the program when no other tasks access the data of the queue.

The USB example i used to config my program is

usbd_lib_hid_generic - LPCOpen

And the FreeRTOS Implementation comes from the

NfcrdlibEx2_AdvancedDiscoveryLoop - SW352221

Could it be that the interrupt of USB is in a wrong Momory Area and this causes the fault because it cannot locate the queue?

Best Regards

Bernd

0 Kudos

795 Views
Kan_Li
NXP TechSupport
NXP TechSupport

Hi Bernd,

How about using xQueueCreateStatic() for this queue?


Have a great day,
Kan

-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------

0 Kudos

795 Views
Kan_Li
NXP TechSupport
NXP TechSupport

Hi Bernd,

Is it possible to have your code for a review?

Thanks for your patience!

Best Regards,

Kan

0 Kudos