[FRDM-KV31F] UART with DMA only on TX with KSDK 1.3

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

[FRDM-KV31F] UART with DMA only on TX with KSDK 1.3

1,028 Views
thomas_kopp
Contributor I

Hello everybody,

For a new project in my company, i am using an FRDM-KV31F board and i am working with gcc and the KSDK 1.3 library, in order to gain time for the different tests that i need to perform.

I am transfering datas from two ADCs via an UART and a specific transfer protocol from my company, which RX frames doesn't have a fixed size.

However, as i need to transfer a lot of datas ( 2 ADCs, each >= 40 kHz), i therefore need to activate DMA on TX but not on RX (because the size of the frames received by the microcontroller can be variable).

I tried many things using the functions in the KSDK 1.3 library but i can't have something working. It seems that the UART_EDMA driver can only configure both TX and RX. I also tried to configure the UART with the UART driver and then to active one DMA channel but i didn't succeed.

Does anyone can give me a code example to do it with the KSDK 1.3 library functions ? or if not possible an other solution ?

Thanks in advance,

Best Regards,

0 Kudos
7 Replies

802 Views
mjbcswitzerland
Specialist V

Hi Thomas

Check out also the uTasker project which includes DMA operation on all UARTs and LPUART of the KV31 (configurable at run time to use interrupt or DMA operations in Tx and Rx directions). It supports free-running Rx DMA operations that is suitable also for random reception lengths, either with the uTasker OS or in FreeRTOS. All operations are simulated on its emulated KV31 (including interrupt and DMA operations in approx. real time) to make development and testing much faster than with traditional debugging tools.

No IDE restrictions (KDS, MCUXpresso, CW, IAR, Keil, Gree Hills, Rowley, Atollic, CooCox, GCC, VisualStudio).
Can be mixed with KSDK library code.
Available as free open source edition on Git Hub or supported version for professional requirements.

Regards

Mark


Kinetis: http://www.utasker.com/kinetis.html
Kinetis KV31:
- http://www.utasker.com/kinetis/TWR-KV31F120M.html
- http://www.utasker.com/kinetis/FRDM-KV31F.html
UART: http://www.utasker.com/docs/uTasker/uTaskerUART.PDF

0 Kudos

802 Views
thomas_kopp
Contributor I

Hi Mark,

Firstly i want to thank you for your answer,

For now, i would prefer to try without an OS but i will consider this option.

Thank you again,

Best Regards,

Thomas

0 Kudos

802 Views
mjbcswitzerland
Specialist V

Thomas

To remove the OS delete the call to uTaskerSchedule().

The UART drivers will still be available but simulation will not be possible.

Regards

Mark

0 Kudos

802 Views
thomas_kopp
Contributor I

Mark, 

Thank you for your answer and for adding the FRDM-KV31F target.

I will try to get familiar with uTasker and to use it after as you recommanded me.

Thank you again,

Regards,

Thomas

0 Kudos

802 Views
thomas_kopp
Contributor I

Hello Mark,

Thank you for this answer,

Unfortunately, i'm a newbie with the microcontroller world and linux so i have some difficulties to use your project.

I am trying to add the functions that i need to my project and for that i am trying to obtain a .a file in order to put it in the Makefile of my project (Is it the good way to proceed ?). Could you tell me if this is possible and if yes, how to proceed ?

Also, in the config.h file, there isn't a #define for the FRDM-KV31F . I guess it's working the same way if i enable the TWR_KV31F120M ?

Thank you in advance,

Best Regards,

Thomas

0 Kudos

802 Views
mjbcswitzerland
Specialist V

Thomas

There is a target for the FRDM-KV31F in the developer's version but presently only a target for the TWR-KV31F board in the open source one. There are not great differences but the inputs and LEDs are on different pins and UARTs connected to other ports.

I'll add a FRDM-KV31F target if needed but the tower one should do.

The project is embedded but has nothing to do with Linux.

It is theoretically possible to create a library but it seems over-complicated to me.

If you don't have much experience but are working on a professional development you might like to look at this:
http://www.utasker.com/services.html
where there is remote desktop training available or a service to completely integrate your existing project into a fully working environment that will allow you to simulate your project (simpler and faster development and debugging as well as much more efficient maintenance and reviews).


In any case, don't miss following the tutorial: http://www.utasker.com/docs/KINETIS/uTaskerV1.4_Kinetis.pdf
and seeing some video guides at  https://www.youtube.com/watch?v=kWNlsAoMly4&list=PLWKlVb_MqDQFZAulrUywU30v869JBYi9Q

There are a couple of videos demonstrating and explaining free-running UART reception, which seems quite unique to the uTasker project and allows minimal overhead even when reception frame lengths are random.

Regards

Mark

0 Kudos

802 Views
mjbcswitzerland
Specialist V

Thomas

I just checked in a FRDM-KV31F target at the GitHub version.

Regards

Mark

The simulation will show:

pastedImage_1.png

0 Kudos