chipKIT® Development Platform

Inspired by Arduino™

Hardware Serial error

Created Wed, 04 Dec 2013 21:07:59 +0000 by kaaasap


kaaasap

Wed, 04 Dec 2013 21:07:59 +0000

I am getting the following errors when including hardwareserial.h.

'isrFunc' does not name a type 'isrFunc' has not been declared

The header file has

class HardwareSerial : public Stream { private: p32_uart * uart; //uart register map isrFunc isr; // the ISR routine to use

and

#if defined(PIC32MX1XX) || defined(PIC32MX2XX) HardwareSerial(p32_uart * uartP, int irq, int vec, int ipl, int spl, isrFunc isrHandler, int pinT, int pinR, ppsFunctionType ppsT, ppsFunctionType ppsR); #else HardwareSerial(p32_uart * uartP, int irq, int vec, int ipl, int spl, isrFunc isrHandler)

anyone know why I am getting this error for the isr???


majenko

Wed, 04 Dec 2013 21:11:25 +0000

You should never need to include HardwareSerial.h. That file is included from within the normal chain, starting with WProgram.h, which is automatically included by the IDE. If you are working outside your main .pde file (say you're writing a library) then you should be including WProgram.h not HardwareSerial.h


kaaasap

Wed, 04 Dec 2013 21:18:27 +0000

I thought I was doing something dumb. Thank you.


kaaasap

Thu, 05 Dec 2013 18:01:37 +0000

Does anyone have an example of how to read and then Serial.print what is coming in on UART2RX (pin39) on a uC32? I am using sparkfun.com rs485 to UART to read from a LVDT sensor.

I am having trouble trying to read it and think I might be heading down the wrong path.

Here is my work (in progress):

#include <plib.h> #include <uart_legacy.h> #include <uart.h> #include <SoftwareSerial.h>

int RXPin = 39; int TXPin = 40;

SoftwareSerial mySerial = SoftwareSerial(RXPin, TXPin);

//#define UART2_BAUD (187500) #define RX_BUFFER_SIZE 32 // RX buffer size #define TX_BUFFER_SIZE 32 // TX buffer size unsigned int rx_buffer[RX_BUFFER_SIZE]; // RX buffer unsigned int tx_buffer[TX_BUFFER_SIZE]; // TX buffer unsigned int RxCtr=0; // Received char counter unsigned char RSFlag=0; // Flag to signal if a serial command was received unsigned char TxCtr=0; // TX char counter unsigned char TxMaxChr=0; // Max char that we have to transmit void UART2SendNak(void); // Send Nak sequence for the here defined simple protocol void UART2SendAck(void); // Send Ack sequence for the here defined simple protocol void checkForSerialCommand(void); // Function used to check the serial command and perform related action char ReadUART2;

void setup() { Serial.begin(115200); mySerial.begin(187500); // Set the direction for the pin used by the UART as RX and TX pin mPORTFClearBits(BIT_8); mPORTFSetPinsDigitalOut(BIT_8); mPORTFSetPinsDigitalIn(BIT_2); // Interrupt enabling for RX and TX section INTEnable(INT_U2RX, INT_ENABLED); // RX Interrupt is enabled INTEnable(INT_U2TX, INT_DISABLED); // TX Interrupt is disabled, no need to fire into it now, only when we need to send out somethings!!

// Set the UART ISR priority and subpriority level SetPriorityIntU2(UART_INT_PR2); SetSubPriorityIntU2(UART_INT_SUB_PR0); // Set system to manage the multi-vectored mode INTConfigureSystem(INT_SYSTEM_CONFIG_MULT_VECTOR); // Enable the interrupt handling from the core INTEnableInterrupts(); }

void loop()

}

Any help would be great.

Thank you.


majenko

Thu, 05 Dec 2013 18:28:32 +0000

That is some bizarre code you have there,

You are using a hardware serial port, yet you are using SoftwareSerial (?!), and using strange plib port and other functions.

why...?

Just use Serial1 as your device (Serial1.available(), Serial1.read(), etc) (already defined) and use pinMode() and digitalWrite() to control your direction pin(s).


kaaasap

Thu, 05 Dec 2013 21:40:56 +0000

Serial1 RX not reading. I did the vector fix and still not working.

help!


bruce741

Mon, 23 Dec 2013 08:13:52 +0000

You are using a hardware serial port, yet you are using SoftwareSerial (?!), and using strange plib port and other functions.