Skip to content

[efr32] update to RAIL 2.x#2401

Merged
jwhui merged 1 commit intoopenthread:masterfrom
jwhui:efr32
Jan 9, 2018
Merged

[efr32] update to RAIL 2.x#2401
jwhui merged 1 commit intoopenthread:masterfrom
jwhui:efr32

Conversation

@jwhui
Copy link
Copy Markdown
Member

@jwhui jwhui commented Dec 6, 2017

This update also makes the following changes:

  • Initialize chip using halInitChipSpecific() provided by RAIL HAL.
  • Use RAIL_HoldRxPacket() to move rx processing out of interrupt context
  • Eliminate critical sections from otPlatRadio* APIs.
  • Use UART driver provided by Gecko SDK.

Resolves #2372
Resolves #2379

//cc @tomas-c @plasticchris @xiaom-GitHub

@jwhui
Copy link
Copy Markdown
Member Author

jwhui commented Dec 6, 2017

@tomas-c, this seems to be working pretty well for me in my limited testing. Would you like to test it out?

@jwhui jwhui force-pushed the efr32 branch 2 times, most recently from 580cc37 to b9eb44d Compare December 6, 2017 21:09
This was referenced Dec 6, 2017
@jwhui jwhui force-pushed the efr32 branch 2 times, most recently from 335ac38 to 31a51cd Compare December 6, 2017 23:35
@tomas-c
Copy link
Copy Markdown
Contributor

tomas-c commented Dec 7, 2017

@jwhui Ahh nice, had been thinking of doing the switch to Rail 2 and the UART driver too. Will test.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for updating to RAIL 2.0 👍 . Please remove duplicated RADIO_CONFIG_XTAL_FREQUENCY and other parameters from openthread-core-efr32-config.h if we put auto-generated header file here.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks! Updated.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this line really needed? Other platforms send nothing on otPlatUartEnable.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This was left over from my own testing. Removed!

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why not use non blocking UARTDRV_Transmit? As I see OT is not designed to be blocked in process drivers call. I think sending big buffer may introduce RF packet drops etc. I notice some issue with EFR32 in case intensive data exchange and sending logs via uart. It looks like the root cause was delay in processTransmit but I didn't investigate it so much.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'll switch this to non-blocking soon.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Updated to use non-blocking UARTDRV_Transmit.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Shall OT_RADIO_CAPS_TRANSMIT_RETRIES be added as well?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does RAIL implement automatic retransmissions on no ack?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I didn't find any info about retransmissions. So, most probably doesn't implement.

@jwhui jwhui force-pushed the efr32 branch 2 times, most recently from 9c87993 to 782bb8a Compare December 15, 2017 01:59
@tomas-c
Copy link
Copy Markdown
Contributor

tomas-c commented Dec 15, 2017

Tested CLI app (used the latest update with async UART). All basic tests mentioned in the porting guide pass. Will soon check with wpantund and a bigger network of devices.

@tomas-c
Copy link
Copy Markdown
Contributor

tomas-c commented Dec 21, 2017

This pull request seems to fix issue #2372.

Not sure if this was an issue with old RAIL implementation (couldn't test due to #2372) but I have noticed the network is much less stable than with SiLabs Thread v2.3.1.0 stack.

Had four devices continuously sending messages to each other. With SiLabs stack I didn't have single missed message over 12 hour period.

With OpenThread I had hundreds of missed messages over the same period with the same setup (same CCA threshold, same transmit power, same channel).

@jwhui
Copy link
Copy Markdown
Member Author

jwhui commented Dec 21, 2017

@tomas-c, thanks for testing and providing feedback! I found a bug in handling RAIL's received packet FIFO. In particular, packets that were in process of being received could be discarded by the example driver. I have updated the example driver to avoid this. When you get a chance, try out the latest and let me know if you see improvement.

@jwhui jwhui force-pushed the efr32 branch 2 times, most recently from 2faceca to 9ecaacb Compare December 21, 2017 19:23
@tomas-c
Copy link
Copy Markdown
Contributor

tomas-c commented Dec 22, 2017

@jwhui Good catch! Been running for three hours already and no lost messages so far.

@jwhui
Copy link
Copy Markdown
Member Author

jwhui commented Dec 22, 2017

@tomas-c, great to hear!

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Spinel docs say flow control must be used. I had framing errors at higher baud rates if it's not enabled.

Tested and works if:

  • Change uartdrvFlowControlNone to uartdrvFlowControlHwUart
  • Change 0,0 at the end of this struct to RETARGET_CTS_LOCATION, RETARGET_RTS_LOCATION

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@tomas-c, thanks! I updated this PR with your proposed changes.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Given UARTDRV_Transmit is asynchronous and aBuf can be reclaimed after otPlatUartSend returns, we should copy aBuf contents, not just its pointer.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah, just saw that layer above makes sure the buffer is not touched until this is done. Disregard.

This update also makes the following changes:
- Initialize chip using `halInitChipSpecific()` provided by RAIL HAL.
- Use `RAIL_HoldRxPacket()` to move rx processing out of interrupt context
- Eliminate critical sections from `otPlatRadio*` APIs.
- Use UART driver provided by Gecko SDK.
@tomas-c
Copy link
Copy Markdown
Contributor

tomas-c commented Jan 8, 2018

I got the system to run for 36h without any issues, with

  • latest code from this PR
  • 115200 baud rate
  • hardware flow control
  • all NCP logging disabled
  • OPENTHREAD_CONFIG_NCP_TX_BUFFER_SIZE increased to 4096
  • OPENTHREAD_CONFIG_NCP_UART_TX_CHUNK_SIZE increased to 512
  • uart.c modified to use a 256 byte ring buffer being serviced by two UARTDRV_Receive() calls in 32 byte chunks

It's difficult to tell at this point which of these were necessary (will not have time to investigate for a while) but might be that the latest changes from this PR and default settings are enough to get a stable network with EFR32.

@jwhui
Copy link
Copy Markdown
Member Author

jwhui commented Jan 8, 2018

@tomas-c, thanks for the feedback again! Do you think this PR is good for merge? If we find more issues, we can address them in subsequent PRs.

@tomas-c
Copy link
Copy Markdown
Contributor

tomas-c commented Jan 8, 2018

This seems to work better than the current Rail 1.x based version and I can't think of any improvements besides maybe increasing UART RX DMA buffer size to something bigger than 1 byte but it's tricky and should probably come as a separate PR.

I'd say let's merge this!

@erbp
Copy link
Copy Markdown

erbp commented Jan 8, 2018

@tomas-c I'm new to openThread, but have built this version for my efr32 dev boards and was wondering how you were testing the stability? You mentioned test sending messages between nodes, was this UDP messages? Do you have a test app that is not included in this repository to do this? I wanted to test sending messages between my dev boards over the thread network, but wasn't sure how to go about this easily.

Thanks.

@tomas-c
Copy link
Copy Markdown
Contributor

tomas-c commented Jan 9, 2018

@erbp If you just want to test whether sending messages works - you can probably just follow the platform readme file and use the ping command. You can also follow the CLI app example or a more involved CLI app + NCP example.

I myself use a bunch of Linux devices running wpantund with NCPs connected to them. I have an existing setup with SiLabs Thread stack so just switched it out with OpenThread to test. Can't really share it but on Linux with wpantund you can write a simple Python script to send UDP packets or even use CoAP.

As for how to send UDP messages directly from the devices without wpantund - someone else might be more equiped to point you in the right direction.

@jwhui
Copy link
Copy Markdown
Member Author

jwhui commented Jan 9, 2018

@tomas-c, thanks for your help on this PR!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants