Dear,
I'm using the KW41Z and have connected a digital magnetic Encoder KMA36 via I2C. When I do the initialization, I send several times 4 Bytes via I2C. In some cases I get an error Status_I2C_Addr_Nak from the RTOS function I2C_RTOS_Transfer(). Attached you'll find a trace from the I2C communication. There you can see that the clock for the NAK is missing.
The controller has integrated I2C modules. How can this occur?
Regards
Lothar
Dear Estephania,
please have a look at my comment from the 06.08.19. You can see that I'm using RTOS function from your SDK to do I2C communication. When I'm using this SDK RTOS function I get problems with the I2C communication. You can see that your SDK RTOS I2C function are using non blocking function. So the blocking should'nt be the problem.
I'm using your RTOS function and get problems with I2C when I implement it in your RTOS example from your SDK. What's wrong in this case?
When I'm using a simple driver example I didn't get any problem.
I didn't understand what you mean with " intrusive to the Bluetooth Le timing stacks".
I didn't see the fault in my application.
Regards
Lothar
Hello,
The RTOS functionality you are using comes from the FreeRTOS implementations of the driver device.
In the Bluetooth LE stack there are several task working, and there are some tasks that must not be interrupted and the code has a special structure that you will not find in the simple driver examples.
What I meant with intrusive, it's that the Bluetooth LE protocol follows certain timings and processes to work correctly according to its specification, if you add a blocking task that might work for your peripherals but not for Bluetooth LE you might have some faults or errors.
There are several documents explaining more about this such as the BLE Application Developer's Guide or Connectivity Framework Reference Manual or you can even check the Bluetooth LE core specification
Also, are you sure that the pins you are using are not being reconfigured in the Bluetooth LE example code you are using ? If you set the functionality of your pins but those are later reconfigured, you will have those issues.
Regards,
Estephania
Dear Estephania,
I didn't implement any blocking task. I use your I2C RTOS function.
Also no reconfiguration of the portpin or I2C interface happen.
I think the conversation is going in the wrong direction.
My question at the beginning of this conversation was "How can it be that a clock puls get missing while I2C communication"? The controller has separate integrated I2C units. Unfortunatley I didn't get any concrete information.
Regards
Lothar
Hello,
If you are completely sure that you are not being intrusive to the system when adding your task, did you checked and verified that the pin you are using it's not being over written in a part of the example or it's being reconfigured correctly in case you are using the low power functionalities?
Regards
Hello,
yes I'm completely sure. No reconfiguratin or pin over writing exist.
The error happen only when I send several times 4 Bytes via I2C as described in my message from 01.08.2019.
Did you try to reproduce the error?
Regards
Lothar
Hello,
I do not have your same encoder, I can set up an I2C but I need to know exactly what are you configuring (pins) when and when are you calling the function in order to fully recreate in on my side. I have worked with the I2C previously with this device and this behavior has not happened before and no one else has reported it yet but you.
I can try checking your code, I do not know how long it will take me due to the current load of work, yet, i can check it out.
Also, maybe you are running out memory to think of something else, you can further debug it with the following definitions
#define gUsePanic_c 1
#define MEM_TRACKING
#define MEM_STATISTICS
#define MEM_DEBUG
#define MEM_DEBUG_OUT_OF_MEMORY
Regards
Dear Estephania,
attached you'll find the code for the kma36 and I2C. I'm not able to send you the complete project.
Thank you for the information about further debug.
Regards
Lothar
Hello,
According to your definitions and the behavior you are experiencing about having issues in the fourth transmission, maybe your problem it's regarding your memory.
Did you tried using the definitions I mentioned ? Are you considering the memory you have available in the example you are using ? The example you are using has a special bootloader, the Bluetooth LE stack, the application plus your complete buffers.
Regards,
Estephania
Dear Estephania,
I couldn't detect any memory issues. The heap has a maximum load of 70%. When the problem occur the bootloader is not active. I've implemented the folowing bootloader: frdmkw41z_wireless_examples_framework_bootloader_otap_bm
Regards
Lothar
Hello,
It will depend on how you are working with the OTA example, if you are using the internal storage, still the OTAP Bootloader image occupies the first part of the flash memory. In the current implementation it has a reserved area of 1/32 of the flash size regardless of the actual size of the image.
The OTAP Bootloader is configured to not overwrite itself so any image sent over the air must not contain the Bootloader application in the reserved section.
Are you considering it ?
Regards,
Estephania
Dear Estephania,
I do not have any problem with the bootloader! Please could we come back to the problemwith the I2C missing clock pulse.
Regards
Lothar
hello,
I mentioned the bootloader as that it's limiting your flash size, and I was not sure you were considering all those elements combined with the stack size.
Which it's the connection interval you set ? Which Bluetooth LE timings did you set in your example ?
Regards,
Estephania
Dear Estephania,
in the message from the 06.08. I told you that no communication is active while the error occur. So there is also no problem with the BLE timing.
Please could you try to retrace the I2C clock missing problem with your hardware.
Regards
Lothar
Hello,
Sorry for the late reply, we have been under a great load of work lately.
As I do not have your hardware the demo used for the test was based in talking to another board. The I2C clock was not lost neither the Bluetooth LE communication.
The implementation was made using the serial manager to ensure the communication both wired and wireless.
A guide it's being made on how to add this implementation, still , something that was noticed during the test was that in some cases there was not enough heap for the semaphores to be created and work correctly as well as a limitation in the semaphores that could be added to the project.
While the guide it's ready, could you please verify those elements in your side?
Regards,
Estephania
Dear Estephania,
we also have some workload and so I decide to implement a workaround. Since then the missing clock pulse didn't occur.
Many thanks for the support.
Regards
Lothar
Hello,
sorry for the delay, still, I'll post here the post whenever it is ready.
Regards ,
Estephania
Dear Estephania,
thanks for your explanation.
There is no problem with the BLE communication. In my case a clock pulse get missing and so I get a NAK instead of an ACK when I send some I2C data. No BLE communication happens while this error occur.
Do you have any other idea?
Regards
Lothar
Hello,
Just to try to corner the case, if you use one of the driver examples , do you have the same issue ?
Regards,
Estephania
Dear Estephania,
as suggest I let run a driver example frdmkw41z_driver_examples_i2c_interrupt_transfer.
The problem didn't occure.
What modification are necessary to let the bluetooth example work without the error above.
Regards
Hello,
You will need to modify your implementation of the I2C and be careful not to use any blocking task that might interfere with the Bluetooth LE stack.
The best choice for you it's to check the BLE Application Developer's Guide , as you will find more information of the stack structure and needed elements to consider and how you should manage your tasks.
Regards,
Estephania