Skip to main content
This topic has been closed for replies.

5 replies

waclawek.jan
Super User
November 13, 2019

EXTI is an *input* interrupt, it has nothing to do with USART Tx.

Did you observe the given Tx pin using oscilloscope or logic analyzer?

Make sure there is no peripheral on the Discovery board connected to the pin you intend to Tx on.

You should perhaps start with a simple polled implementation, then move on to DMA.

I don't use Cube/CubeMX.

JW

Ozone
Principal
November 13, 2019

> I don't use Cube/CubeMX.

Me neither.

The shown code expects the HAL_USART_Transmit_DMA() function to be synchronous and blocking. Check this is actually the case.

Ala
AlaAuthor
Senior
November 13, 2019

dear Ozone

yes, HAL_USART_Transmit_DMA() is synchronous, but what do you mean by "blocking"?

waclawek.jan
Super User
November 13, 2019

> it shows the data being transferred. but I don't see the output results.

What do you mean by "output results"? From the STM32 point of view, for Tx, if the data are output onto the pin, there's nothing more to be done.

"Polled implementation" is non-DMA, non-interrupt, i.e. after writing one byte into the UART_DR, waiting in a loop, until USART signals in its status register that that byte has been transmitted.

JW

Ala
AlaAuthor
Senior
November 13, 2019

by "not seeing the out put results" I mean I don't see the data being printed on the paper.

yes I've tried HAL_USART_Transmit() first, then I thought maybe I should get rid of "timeout", so I switched to HAL_USART_Tranmit_DMA(), but I'm still confused...

I keep staring the monitor to find out the problem but I get nothing...:sad_but_relieved_face:

Tesla DeLorean
Guru
November 13, 2019

Quit with the casting a character byte as a pointer​ nonsense, that ain't gonna work.

Tips, Buy me a coffee, or three.. PayPal VenmoUp vote any posts that you find helpful, it shows what's working..
Ala
AlaAuthor
Senior
November 13, 2019

I just want to send a HEX data, what should I do then? please help me!!!! I'm really confused...

Tesla DeLorean
Guru
November 13, 2019

Use a subroutine, pass it a char variable, and then pass a pointer to that to the transmit function. ie &ch, 1

Using (char *)0x32 passes an address of 0x32 to the routine. It is not 8 bytes wide either.

Tips, Buy me a coffee, or three.. PayPal VenmoUp vote any posts that you find helpful, it shows what's working..
PKvac.1185
Visitor II
November 13, 2019
  1. Make buffer:

#define BUFFER_LENGHT 8

static uint8_t cPrnBuffer[BUFFER_LENGHT];

2. Fill buffer with data:

static void vPrnBufferFill(void){

uint16_t i;

for (i=0;i<BUFFER_LENGHT;i++) {

cPrnBuffer[i]=0x32;//for example

}

}

3. Send data:

HAL_USART_Transmit_DMA(&husart1,cPrnBuffer,BUFFER_LENGHT);

Ala
AlaAuthor
Senior
November 13, 2019

I had a buffer like that, but it doesn't work.

@Community member​  says that 0x32 is just an address!! and it is not interpreted as a HEX data...

PKvac.1185
Visitor II
November 13, 2019

That right, " (uint8_t*)0x32" is just a pointer to data, located in 0x32 address, but it is mistake. You need to send right pointer to function HAL_USART_Transmit_DMA(). For axample if you have data buffer "BUFFER_NAME[BUFFER_LENGHT]" send pointer to function with "BUFFER_NAME" or "&BUFFER_NAME[0]" instead of "(uint8_t*)0x32".

Ala
AlaAuthor
Senior
November 16, 2019

can I send you the whole document by email?