Hello,
I would like to use my EB065 on an USART2. I've set MX_GPS_UART=2 in the code customization area. But it doesn't work. On USART1, the program works as expected. I am using a PIC18F45k22.
Is there an issue with the PPS-Signal? The jumper settings are C&1.
Best regards
Simon
Using GPS Module on USART2
- Benj
- Matrix Staff
- Posts: 15312
- Joined: Mon Oct 16, 2006 10:48 am
- Location: Matrix TS Ltd
- Has thanked: 4803 times
- Been thanked: 4314 times
- Contact:
Re: Using GPS Module on USART2
Hi Simon,
When you change the definition from
to
it should work to switch the GPS to UART2.
Does the program compile ok when you have done this or are there any error messages?
The Jumper settings of the E-block should be made so that the serial data signals are routed through to the UART2 pins. The EB056 datasheet should help to get the jumpers setup correctly. The PPS signal does not have to be connected and is just made available should anyone want to bring it into their application.
When you change the definition from
Code: Select all
#define MX_GPS_UART 1 //%e //UART Control
Code: Select all
#define MX_GPS_UART 2 //%e //UART Control
Does the program compile ok when you have done this or are there any error messages?
The Jumper settings of the E-block should be made so that the serial data signals are routed through to the UART2 pins. The EB056 datasheet should help to get the jumpers setup correctly. The PPS signal does not have to be connected and is just made available should anyone want to bring it into their application.
Regards Ben Rowland - MatrixTSL
Flowcode Product Page - Flowcode Help Wiki - Flowcode Examples - Flowcode Blog - Flowcode Course - My YouTube Channel
Flowcode Product Page - Flowcode Help Wiki - Flowcode Examples - Flowcode Blog - Flowcode Course - My YouTube Channel
Re: Using GPS Module on USART2
Hello Benj,
unfortunately it doesn't work. I've attached my flowchart. The RX1/TX1-Pins are RC7/RC6 and RX2/TX2 are at RD7/RD6. Though, I think that I don't have to change my jumper settings.With it works fine.
The code does compile without errors.
Edit:
Here is a little snippet from the generated asm-file:
MOVWF gbl_txsta2
MOVLW 0x19
MOVWF gbl_spbrg2
CLRF gbl_rcsta2
BSF gbl_rcsta2,7
BCF gbl_intcon,7
CALL FCD_GPS0_G_0003E
CALL FCD_GPS0_G_0003E
BSF gbl_txsta,5
Everything points to rcsta2 and txsta2 but not the last row. It is the txen-Bit of USART 1 and I think it should be: bsf gbl_txsta2,5.
Could this be the error and how can a solve it?
Best regards
Simon
unfortunately it doesn't work. I've attached my flowchart. The RX1/TX1-Pins are RC7/RC6 and RX2/TX2 are at RD7/RD6. Though, I think that I don't have to change my jumper settings.With
Code: Select all
#define MX_GPS_UART 1
The code does compile without errors.
Edit:
Here is a little snippet from the generated asm-file:
MOVWF gbl_txsta2
MOVLW 0x19
MOVWF gbl_spbrg2
CLRF gbl_rcsta2
BSF gbl_rcsta2,7
BCF gbl_intcon,7
CALL FCD_GPS0_G_0003E
CALL FCD_GPS0_G_0003E
BSF gbl_txsta,5
Everything points to rcsta2 and txsta2 but not the last row. It is the txen-Bit of USART 1 and I think it should be: bsf gbl_txsta2,5.
Could this be the error and how can a solve it?
Best regards
Simon
- Attachments
-
- Flowcode45kGPS2.fcf
- (13.17 KiB) Downloaded 340 times
- Benj
- Matrix Staff
- Posts: 15312
- Joined: Mon Oct 16, 2006 10:48 am
- Location: Matrix TS Ltd
- Has thanked: 4803 times
- Been thanked: 4314 times
- Contact:
Re: Using GPS Module on USART2
Hi Simon,
That's great thanks you pointed me straight to the bug.
Here is the updated component C file for v4 which should hopefully now work correctly for you on UART2.
Simply place the file into your Flowcode v4/Components directory before starting Flowcode. You may also have to revert the code back to default to allow the changes to be brought in before switching the UART channel definition back to 2.
That's great thanks you pointed me straight to the bug.
Here is the updated component C file for v4 which should hopefully now work correctly for you on UART2.
Simply place the file into your Flowcode v4/Components directory before starting Flowcode. You may also have to revert the code back to default to allow the changes to be brought in before switching the UART channel definition back to 2.
Regards Ben Rowland - MatrixTSL
Flowcode Product Page - Flowcode Help Wiki - Flowcode Examples - Flowcode Blog - Flowcode Course - My YouTube Channel
Flowcode Product Page - Flowcode Help Wiki - Flowcode Examples - Flowcode Blog - Flowcode Course - My YouTube Channel
Re: Using GPS Module on USART2
Hi Benj,
I like diving into assembly code.
Unfortunately it doesn't work.
But I've found the following things:
pie4 has to be changed to pie 3
pir4 has to be changed to pir3
Now it works as expected. Hopefully these changes match the other chips with two USART.
I've attached my new c-file: Thank you very much. Now I am going to solve my other prob
Best regards
Simon
I like diving into assembly code.

Unfortunately it doesn't work.
But I've found the following things:
pie4 has to be changed to pie 3
pir4 has to be changed to pir3
Now it works as expected. Hopefully these changes match the other chips with two USART.
I've attached my new c-file: Thank you very much. Now I am going to solve my other prob

Best regards
Simon
- Benj
- Matrix Staff
- Posts: 15312
- Joined: Mon Oct 16, 2006 10:48 am
- Location: Matrix TS Ltd
- Has thanked: 4803 times
- Been thanked: 4314 times
- Contact:
Re: Using GPS Module on USART2
That's great thanks for letting me know and glad its working correctly for you now.
Regards Ben Rowland - MatrixTSL
Flowcode Product Page - Flowcode Help Wiki - Flowcode Examples - Flowcode Blog - Flowcode Course - My YouTube Channel
Flowcode Product Page - Flowcode Help Wiki - Flowcode Examples - Flowcode Blog - Flowcode Course - My YouTube Channel