Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

Reflecting input as output

Status
Not open for further replies.

sbhanot030

Junior Member level 1
Junior Member level 1
Joined
Sep 25, 2023
Messages
17
Helped
0
Reputation
0
Reaction score
0
Trophy points
1
Activity points
128
Hi all
My doubt is while taking in input from a particular I/O pin in STM32 and sending it as it is through an output pin but has additional clock and enable along coming out of different pins but have to travel together to the same destination. the problem that I am getting is I have declared a variable to the input but putting the same name in write pin function in which I have declared my output pin is giving an error of incompatible type for HAL_GPIOWritePin, can someone please share what I can do to resolve this
 

Hi,

why not showing your code?
why not showing the exact error code?

Klaus
 

1697088583436.png

Hi the above is the section of the code where the error is coming. The error is "incompatible type for argument 3 of 'HAL_GPIO_WritePin'". The problem is the variable's name is &RX1_Char which I want to send directly pin A5 but there is an incompatibility error.
 

Hi,

Did you read the documentation for both HAL functions?
I did not .... but from a first view I don't think you use them correctly.

For reading a pin you usually need:
* to tell the port
* to tell which pin of the port
* a variable where to store the result ..... this is what I miss
All three of them need to match the function description

***
All in all I don't understand your concept.
I guess you did not draw a flow chart. If you did: show it. If you did not: then do it now, and show it. No need to be fancy, paper and pencil will do.

What your code does:
* Read a pins state .... but immediately dismiss the result
* in best case it sends out some random characters via UART. (Here you try to send something before you received it)
* you write a pin with the random contents of a variable... before you filled the variable with meaningful content. I'm not sure whether you use the right type of variable.
* next you try to receive data from the UART into a variable. The same variable that you used before to send to the output port.
"You try" ... because you used the non blocking "...RECEIVE_IT" function. It immediatly comes back and does not wait for a character to be received.
* next you initialise a variable ... no idea why
* then you (busy) wait 100 ms. ... no idea why
* then you do all the above in a loop

It all makes no sense.
Variables/values.
* a pin has two states: HIGH or LOW (TRUE/ FALSE), thus it makes sense to use a "BOOLEAN" type variable
* a UART character usually is a byte, it has 256 states. It makes sense to use a CHAR type variable.
(technically both variable may be stored in a byte ... but you need to be aware of their according states, the range and the meaning)
* usually when sending a BOOL variable over UART, you should translate (or cast) it into the CHAR variable (or array of chars)
* HOW you need to translate depends on what you want to receive at the other end of the UART. Please tell us.


Klaus
 

Status
Not open for further replies.

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top