Constantly output character from UART

Tip / Sign in to post questions, reply, level up, and achieve exciting badges. Know more

cross mob
MuKa_284621
Level 3
Level 3

Hello,

   

 

   

I'm thinking of how to constantly output a character from the UART.

   

 

   

For example, the character 'h' will be outputted from the UART constantly.

   

 

   

The challenge is, I want to do it without calling a function like printf (ie. I don't want to use the CPU) AND without using the DMA.

   

 

   

Is that even possible? Or am I being too imaginative?

   

 

   

I know that the TX reg for the UART is a FIFO type, so I don't think I'd be able to hold data in there permanently.

   

 

   

Thanks,

0 Likes
9 Replies
Bob_Marlowe
Level 10
Level 10
First like given 50 questions asked 10 questions asked

Easiest would be in an interrupt routine reacting un fifo empty and stuffing the fifo up to the top.

   

DMA is possible as well, choose your favorite method.

   

 

   

Bob

0 Likes
EvPa_264126
Level 7
Level 7
500 replies posted 250 replies posted 100 likes received

   

if it is always the same character - perhaps a LUT/constant  +

   

   

shift register ?  ))))

   

 

   
0 Likes
HeLi_263931
Level 8
Level 8
100 solutions authored 50 solutions authored 25 solutions authored

You can create your own TX UART doing that. As a starting point, look at the PSoC Sensei blog. You just need to change it so it transmits the same character again if the last one has been sent out completely.

0 Likes
MuKa_284621
Level 3
Level 3

 Hello,

   

 

   

I think I'll just go with DMA, like Bob suggested. Much simpler IMHO.

   

 

   

Is it possible to transfer a constant situated in memory to UART Tx reg? I tried defining a region using the __attribute__ macro. Not sure now where I could put it in memory.

0 Likes
Bob_Marlowe
Level 10
Level 10
First like given 50 questions asked 10 questions asked

Declare a global byte var (may be a const) and take it as source of DMA, Use 1 byte transfer and use the Tx int as start of DMA.

   

 

   

Bob

0 Likes
MuKa_284621
Level 3
Level 3

 I did this :

   

 

   

const uint8 car __attribute__ ((section(".CARCONST"))) = 'H';

   

 

   

I added an extra line in the linker to start the section at 0x00001000 (should be in Flash I think).

   

 

   

Not sure how to configure DMA TD.

0 Likes
Bob_Marlowe
Level 10
Level 10
First like given 50 questions asked 10 questions asked

There is a DMA wizard to specify your Td.

   

Skip all that _attibute_ junk and the linker stories, you do not need that at all.

   

Pich a DMA-example from creator (for PSoC5) and see how it is organized.

   

 

   

Bob

   

(Sorry, no time at the moment to build an example myself)

0 Likes
MuKa_284621
Level 3
Level 3

 Alright,

   

 

   

It's okay, you guys helped me with this DMA stuff back then, still got those files handy.

   

 

   

Thanks,

0 Likes
MuKa_284621
Level 3
Level 3

 Ok it's working.

   

 

   

Seemingly I forgot to enable the DMA, I've been going thru the codes for a while now 

0 Likes