!Hello everyone,
I have a board composed of a MK10DN512VLL10 connected via UART to a Fastrax UP501 GPS module.
Main:
#define STDIO_UART1
volatile bool contr_GPS = false;
volatile char GPS_buff[3000];
volatile int i=0;
#ifdef STDIO_UART1
// enable GPS connector to be used as external UART connection
PTC->PSOR = (1u << 1);
uart_enable(1, 9600, false, true);
printf("ready.\r\n");
#endif
for(;;)
{
{
| | for (z=0; z<3000; z++) | |
| printf("%c", GPS_buff[z]); | | |
}
}
Interrupt management:
extern volatile char GPS_buff[];
volatile char *data=GPS_buff;
volatile bool contr_write = true;
extern volatile bool contr_GPS;
extern volatile int i;
static void process_irq(uint8_t dev) {
UART_Type *uart = uart_reg[dev];
//UART_Trans *buffer;
if (uart->S1 & UART_S1_TDRE_MASK) {
// NON C'E' NULLA PERCHE' TEORICAMENTE DOVREBBE DARE QUALCUSA DI DEFAULT
}
if (uart->S1 & UART_S1_RDRF_MASK) {
if (i<3000){
*data++ = uart->D;
i++;
}
else
{
uart->C2 &= ~UART_C2_RIE_MASK;
uart->C2 &= ~UART_C2_RE_MASK;
contr_GPS = true;
}
}
}
If I remove contr_GPS and random print stuff out but meaningless symbols. Example:
? Cm? T? À "6½UùÄ? UG0? ¾m8? ËWÞÑæ +> ?? W®ÝUâ? ‡, |ù? Õ [??,? ÞÓÙú
Hz? $: bQŸZø "Å × · §ºö? † Ñ ?? ߧĺ6Ë AU ÷ Á ¢,? - ¡° Ê ú- ^ J¤ † Æ ÷? OCHA? Aini ??? 7ØU¤½ü%? Œ \ ä¼0? ¢ ñ> ݺ-ù9Tê? Æ? Y ÷ ü £
If you leave the condition contr_GPS prints nothing.
Do you have any tips or suggestions to understand or correct the mistake?
Thank you