Replies: 8 comments 11 replies
-
What’s missing in your code from branch https://github.com/RobertK66/obc_1769_core/tree/STP is: I would suggest that you remove both the pEnablePin and the pPpsPin (feature pins of my GPS hardware) from the init structure and replace it with your “pRs485DirPin” which should reference the currently used GPIO: P2[5]/(IC101-68) named PINIDX_RS485_TX_RX in the pinning_climbobc.h file. Then you have to code that this pin is switched correctly for RX – TX. As you already succeeded in sending out bytes, I assume the default value currently set is for “TX”. You can manually switch this GPIO by using the “h 43 1” or “h 43 2” command. Here 43 is the real index number from the enum RS485_TX_RX and this crude hardware test command uses this as direct index into the pinmuxing2[] array. |
Beta Was this translation helpful? Give feedback.
-
I made recent code commit regarding that. But where this wire has to be connected on RS485 converter ? |
Beta Was this translation helpful? Give feedback.
-
@kodsurf : For doku purpose I do repeat the Info here which I sent to you per DM (on 22.3.2022): In EM2 we refactored the RS485 interface to use UART1! |
Beta Was this translation helpful? Give feedback.
-
In the code that I recently pushed into STP branch (regarding RS485 tx rx dirrection controll) After switching PINIDX_RS485_TX_RX TRANSMIT to TX mode so that data bytes can be transmitted - delay has to be introduced ( see image). Otherwise bytes does not come through. Please advice how to introduce this delay in a proper way. |
Beta Was this translation helpful? Give feedback.
-
Ok, I think I have a solution for problem described above - but please check and confirm that it is correctly understood by me On the right side I tested C code to change bit at a certain position (p) of data variable . Output looks like what I was expecting. So I want to use this method to change one bit at LPC_UART1->RS485CTRL register. Does this looks correct ? |
Beta Was this translation helpful? Give feedback.
-
Beta Was this translation helpful? Give feedback.
-
and finally to your above question
No I can't. That's the reason you have to make it work and play around with it! -> Meassure with OSZI and analyze relliabillity of results...... Normally putting a GPIO to low works pretty 'instant'. So maybe none or only some instructions later everything should be ok. But if you have some outputs which are 'switched to high' by leaving the lines in 'high resistance'. Then the Pull Up resistor(s) used and the current it draws has influence on the time which has to be waited until this line is considered 'free'. On the RS485 bus you should see this times when the A-B lines drift to there 'idle' state after Tx (by OBC -> our 'leave lines high') or after RX (from Thruster -> thruster 'release lines'....) This all depends on R values (on A-B) and line length and, and, and ...... |
Beta Was this translation helpful? Give feedback.
-
Another issue that I have discovered with current version of STP branch. Last byte of request that are intended to be sent is replaced with FF. Which is wrong ! |
Beta Was this translation helpful? Give feedback.
-
Let's use this place for code questions regarding the usage of the RS485 interface on OBC Y+ connector.
Beta Was this translation helpful? Give feedback.
All reactions