Ultron

Forum Replies Created

Viewing 7 posts - 1 through 7 (of 7 total)
  • Author
    Posts
  • in reply to: [HELP] Remapping Serial0 to Serial1 on ATXMEGA192 #7256
    Ultron
    Member

    YEAAAAHHHH! It’s works!

    For anyone with my problem:

    Open the file xio_usart.h. Go down at this section: //**** USB device configuration ****

    In this section code you must change these lines:

    #define USB_USART USARTC0 // USB usart
    #define USB_RX_ISR_vect USARTC0_RXC_vect // (RX) reception complete IRQ
    #define USB_TX_ISR_vect USARTC0_DRE_vect // (TX) data register empty IRQ

    with these lines:

    #define USB_USART USARTC1 // USB usart
    #define USB_RX_ISR_vect USARTC1_RXC_vect // (RX) reception complete IRQ
    #define USB_TX_ISR_vect USARTC1_DRE_vect // (TX) data register empty IRQ
    (only change the C0 with C1 serial port)

    These lines:
    #define USB_CTS_bp (1) // CTS – bit position (pin is wired on board)
    #define USB_CTS_PINCTRL PIN1CTRL // CTS – PINxCTRL assignment

    with these lines:
    #define USB_CTS_bp (5) // CTS – bit position (pin is wired on board)
    #define USB_CTS_PINCTRL PIN5CTRL // CTS – PINxCTRL assignment
    (move the old pin1 to new pin5 for CTS signal)

    This line:
    #define USB_RTS_bp (0) // RTS – bit position (pin is wired on board)

    with line:
    #define USB_RTS_bp (4) // RTS – bit position (pin is wired on board)
    (move the old pin 0 to new pin 4 for RTS signal)

    These lines:
    #define USB_RX_bm (1<<2) // RX pin bit mask
    #define USB_TX_bm (1<<3) // TX pin bit mask

    with these lines:
    #define USB_RX_bm (1<<6) // RX pin bit mask
    #define USB_TX_bm (1<<7) // TX pin bit mask
    (move the old 2,3 RX-TX pins to new pins 6 and 7)

    In this section: //**** RS485 device configuration (no echo or CRLF) ****
    you must change the RS485-Serial pins and the Interrupts vector.

    replaced these lines:

    #define RS485_USART USARTC1 // RS485 usart
    #define RS485_RX_ISR_vect USARTC1_RXC_vect // (RX) reception complete IRQ
    #define RS485_TX_ISR_vect USARTC1_DRE_vect // (TX) data register empty IRQ
    #define RS485_TXC_ISR_vect USARTC1_TXC_vect // (TX) transmission complete IRQ

    #define RS485_PORT PORTC // port where USART is located
    #define RS485_RE_bm (1<<4) // RE (Receive Enable) pin – active lo
    #define RS485_DE_bm (1<<5) // DE (Data Enable)(TX) – active hi
    #define RS485_RX_bm (1<<6) // RX pin
    #define RS485_TX_bm (1<<7) // TX pin

    with these lines:

    #define RS485_USART USARTC0 // RS485 usart
    #define RS485_RX_ISR_vect USARTC0_RXC_vect // (RX) reception complete IRQ
    #define RS485_TX_ISR_vect USARTC0_DRE_vect // (TX) data register empty IRQ
    #define RS485_TXC_ISR_vect USARTC0_TXC_vect // (TX) transmission complete IRQ

    #define RS485_PORT PORTC // port where USART is located
    #define RS485_RE_bm (1<<0) // RE (Receive Enable) pin – active lo
    #define RS485_DE_bm (1<<1) // DE (Data Enable)(TX) – active hi
    #define RS485_RX_bm (1<<2) // RX pin
    #define RS485_TX_bm (1<<3) // TX pin
    ————————

    Basically we reversed the USB-serial with RS485-serial (not used)

    Good work…

    Guido

    in reply to: [HELP] Remapping Serial0 to Serial1 on ATXMEGA192 #7253
    Ultron
    Member

    Yes, but i don’t use debugger.

    All port in chip are ok. I make some test in all pin (PortA, B, C, D, E, F) and all ok (except portC2).

    I Have check this file: xio.usart.h

    Inside this file there is pre-processor #define block:

    ————————————-
    //**** USB device configuration ****
    //NOTE: XIO_BLOCK / XIO_NOBLOCK affects reads only. Writes always block. (see xio.h)

    #define USB_BAUD XIO_BAUD_115200
    #define USB_FLAGS (XIO_BLOCK | XIO_ECHO | XIO_XOFF | XIO_LINEMODE )

    #define USB_USART USARTC0 // USB usart
    #define USB_RX_ISR_vect USARTC0_RXC_vect // (RX) reception complete IRQ
    #define USB_TX_ISR_vect USARTC0_DRE_vect // (TX) data register empty IRQ

    #define USB_PORT PORTC // port where the USART is located
    #define USB_CTS_bp (1) // CTS – bit position (pin is wired on board)
    #define USB_CTS_bm (1<<USB_CTS_bp) // CTS – bit mask
    #define USB_CTS_PINCTRL PIN1CTRL // CTS – PINxCTRL assignment
    #define USB_CTS_ISR_vect PORTC_INT0_vect // CTS – Interrupt Vector (PORTC_INT0_vect or PORTC_INT1_vect)
    #define USB_CTS_INTMSK INT0MASK // CTS – Interrupt Mask Register (INT0MASK or INT1MASK)
    #define USB_CTS_INTLVL (PORT_INT0LVL_LO_gc)

    #define USB_RTS_bp (0) // RTS – bit position (pin is wired on board)
    #define USB_RTS_bm (1<<USB_RTS_bp) // RTS – bit mask

    #define USB_RX_bm (1<<2) // RX pin bit mask
    #define USB_TX_bm (1<<3) // TX pin bit mask

    #define USB_INBITS_bm (USB_CTS_bm | USB_RX_bm) // input bits
    #define USB_OUTBITS_bm (USB_RTS_bm | USB_TX_bm) // output bits
    #define USB_OUTCLR_bm (USB_RTS_bm) // outputs init’d to 0
    #define USB_OUTSET_bm (USB_TX_bm) // outputs init’d to 1
    ————————-

    I think that this is the critical point. Can anyone confirm?

    in reply to: [HELP] Remapping Serial0 to Serial1 on ATXMEGA192 #7251
    Ultron
    Member

    Thanks for reply.

    I should study all files of the project. This is beyond my skill.

    The Hardware is simple. I not use the SPI, therefore no conflict.

    I already soldered two wires on two pin of the chip atxmega. Pin are number 22 and 23 (serial1). I must only remap the serialport on the Firmware, and compile it.

    My simple verify of the PortC pin

    #include <avr/io.h>
    #include <util/delay.h>
    
    #define BLINK_DELAY_MS 1000
    
    int main( void )
    {
      PORTC.DIRSET = 0b11111111 ; // Set pin0  to 7 to be output.
      
      while(1){ // loop forever
        PORTC.OUTSET = 0b11111111 ; // set  all output high.
        _delay_ms( BLINK_DELAY_MS ) ; // wait.
        PORTC.OUTCLR = 0b11111111 ; // set  all output low.
        _delay_ms( BLINK_DELAY_MS ) ; // wait.
      }
    }

    In this code, output portC 0,1,3,4,5,6,7 blinking well, but portC 2 not blink (the RX input). No output, either HIGH or LOW. This is broken!

    in reply to: [HELP] Remapping Serial0 to Serial1 on ATXMEGA192 #7248
    Ultron
    Member

    In that place i have not help. Someone said that it is not the right place.

    Existing some configuration file (.H) where i can setting the serial port, first i build the project?

    in reply to: TinyG with uC for stand-alone CNC #7139
    Ultron
    Member

    Thanks a lot.

    I will open a Thread in your suggested Forum.

    in reply to: TinyG with uC for stand-alone CNC #7136
    Ultron
    Member

    I read the faq.

    So … my uc sends the G-Code text through the serial, meanwhile listens in receiving.
    When it receives a data, an interrupt is triggered that analyzes if the data contain the character of xoff (0x13), and the transmission stops until the PIC32 has received the data of xon (0x11) from ATxmega.

    it’s that simple?

    What kind of string (before starting) I have to send to activate the flow control?

    Thanks

    Guido from Italy

    • This reply was modified 9 years, 9 months ago by Ultron.
    in reply to: TinyG with uC for stand-alone CNC #7133
    Ultron
    Member

    Ok, thanks a lot! My project started several months ago, but the G-Code interpreter has been a big obstacle (for arch and circle functions), so now i can “cut the head at the bull” (an italian slang 😉 ) and i use TinyG with my uC PIC32MZ series with 7″ TFT touch display (Human Interface Machine) and Sdcard.
    My uC for HID, and your ATXmega for G-Code Intepreter!
    I am happy! 🙂

    Simply the code reads SDcard file, and it sends lines to ATXmega, one at a time, with a little delay() among the instrunctions, or it uses the RTS line for wait every time, the buffer is full. It’s Ok?

Viewing 7 posts - 1 through 7 (of 7 total)