Hi,
I'm looking for an example of how NRFX_UARTE works.
I would like to set up a serial port with EasyDMA to send and receive a thirty bytes.
Thanks in advance for your help.
Best regards,
Hi,
I'm looking for an example of how NRFX_UARTE works.
I would like to set up a serial port with EasyDMA to send and receive a thirty bytes.
Thanks in advance for your help.
Best regards,
Do you mean the Nordic UART Service - NUS?
The examples appear under the SDK in the Infocenter; eg,
http://infocenter.nordicsemi.com/topic/com.nordic.infocenter.sdk5.v15.0.0/examples_ble.html - Central
http://infocenter.nordicsemi.com/topic/com.nordic.infocenter.sdk5.v15.0.0/examples_ble.html - Peripheral
Hi awneil,
Thanks for your answer but I don't want send and receive bytes by BLE, just with serial port.
I need to use UARTE, not BLE Service NUS.
I don't understand how to get all the interruption that I wish as an event in the handler.
For example, how to be informed of RXSTARTED for load another buffer as seen in Figure 95 of the nRF52832 datasheet.
If I use another way of doing this, for example :
NRF_UARTE0->ENABLE = (UARTE_ENABLE_ENABLE_Enabled << UARTE_ENABLE_ENABLE_Pos); NRF_UARTE0->BAUDRATE=NRF_UARTE_BAUDRATE_115200; NRF_UARTE0->PSEL.RXD=RX_PIN_NUMBER; NRF_UARTE0->PSEL.TXD=TX_PIN_NUMBER; NRF_UARTE0->CONFIG=NRF_UARTE_HWFC_DISABLED; NRF_UARTE0->TXD.PTR = (uint32_t)((uint8_t *)txUarteBuffer); NRF_UARTE0->TXD.MAXCNT = sizeof(txUarteBuffer); NRF_UARTE0->TASKS_STARTTX = 0; NRF_UARTE0->RXD.PTR = (uint32_t)((uint8_t *) rxUarteBuffer); NRF_UARTE0->RXD.MAXCNT = sizeof(rxUarteBuffer); NRF_UARTE0->TASKS_STARTRX = 1;
How to create an handler for event ?
if I use :
NRF_UARTE0->INTENCLR = 0xFFFFFFFF; NRF_UARTE0->INTENSET = NRF_UARTE_INT_ENDRX_MASK; NVIC_ClearPendingIRQ(UARTE0_UART0_IRQn); NVIC_SetPriority(UARTE0_UART0_IRQn, NRFX_UARTE_DEFAULT_CONFIG_IRQ_PRIORITY); NVIC_EnableIRQ(UARTE0_UART0_IRQn);
I have :
<error> app: ERROR 3735928559 [Unknown error code] at .......\modules\nrfx\drivers\src\prs\nrfx_prs.c:81
PC at: 0x0002C49F
<error> app: End of error report
Someone can help me ?
Thanks in advance.
Best regards,
Hi,
It looks like you are mixing bare metal implementation, and using the nrfx_uarte driver. You must disable the nrfx_uarte module in order to use the UARTE peripheral directly.
Best regards,
Håkon
Hi Hakon,
Thanks for your help.
For disabling nrfx, I need to modify sdk_config.h and not included nrfx_uarte.h ?
I need to include just "nrf_uarte.h" ?
How to create UARTE0_UART0_IRQ in my main software ?
Sorry for all these questions, but I feel like going round with all these UART driver ...
Best regards,
You need to edit your sdk_config.h file, and set:
void UARTE0_UART0_IRQHandler(void) { // Code }
Ok.
I include only "nrf_uarte.h"
and with void UARTE0_UART0_IRQHandler(void) I have an error :
1> main.o: In function `UARTE0_UART0_IRQHandler':
1> main.c:729: multiple definition of `UARTE0_UART0_IRQHandler'
1> Nordic_BLE\nRF5_SDK_15.0.0\modules\nrfx\drivers\src/nrfx_uarte.c:571: first defined here
If I keep NRFX_PRS_ENABLED = 1 and NRFX_PRS_BOX_4_ENABLED 1, I have an error :
1> main.o: In function `UARTE0_UART0_IRQHandler':
1> main.c:728: multiple definition of `UARTE0_UART0_IRQHandler'
1> Nordic_BLE\nRF5_SDK_15.0.0\modules\nrfx\drivers\src\prs/nrfx_prs.c:81: first defined here
Ok.
I include only "nrf_uarte.h"
and with void UARTE0_UART0_IRQHandler(void) I have an error :
1> main.o: In function `UARTE0_UART0_IRQHandler':
1> main.c:729: multiple definition of `UARTE0_UART0_IRQHandler'
1> Nordic_BLE\nRF5_SDK_15.0.0\modules\nrfx\drivers\src/nrfx_uarte.c:571: first defined here
If I keep NRFX_PRS_ENABLED = 1 and NRFX_PRS_BOX_4_ENABLED 1, I have an error :
1> main.o: In function `UARTE0_UART0_IRQHandler':
1> main.c:728: multiple definition of `UARTE0_UART0_IRQHandler'
1> Nordic_BLE\nRF5_SDK_15.0.0\modules\nrfx\drivers\src\prs/nrfx_prs.c:81: first defined here
Did you set this in your sdk_config.h file and re-compile the whole project (clean first, then build)?
#define NRFX_UARTE_ENABLED 0
The first error is because nrfx_uarte.c is still enabled, and the second is due to the "nrfx_prs" library being used by nrfx_uarte is in use.
I have :
NRFX_UARTE_ENABLED 0
NRFX_UARTE0_ENABLED 0
NRFX_UART_ENABLED 0
NRFX_UART0_ENABLED 0
UART_ENABLED 1
UART_EASY_DMA_SUPPORT 1
UART_LEGACY_SUPPORT 0
UART0_ENABLED 1
UART0_CONFIG_USE_EASY_DMA 1
NRFX_PRS_ENABLED 1
NRFX_PRS_BOX_4_ENABLED 1
Could you try to remove the nrfx_uarte.c and nrfx_prs.c from your project and see if it works then?
Thank you, it seems to work now. I test it all and come back here to say if everything is ok.
I will not have compatibility problems with future SDKS?
Glad to hear that it works now.
A general rule is that as long as you do not add or use any modules that depends on the UART peripheral, it should be fine. As you're doing a bare-metal implementation, it is _very unlikely_ that the register definitions will ever change for the current device that you are using.
However; I cannot guarantee that a module that you require in the future does not depend on the UART in some way (for logging or similar).
Best regards,
Håkon