Having some issues switching from ATmega products to Xmega products. I'm beating my head on the desk trying to figure out why I have no data showing up on either side of the USART. This is my code, I am praying to the AVRFreak gods to give me some advice.
Main:
int main (void) { board_init(); sysclk_init(); rtc_m_init(); pmic_init(); delay_init(sysclk_get_cpu_hz()); pmic_set_scheduling(PMIC_SCH_ROUND_ROBIN); cpu_irq_enable(); ....
USART Code:
//Using a FIFO buffer on both RX and TX union wireless_buffer fifo_rx_buffer[WIRELESS_RX_BUFFER_SIZE],fifo_tx_buffer[WIRELESS_TX_BUFFER_SIZE]; fifo_desc_t fifo_rx_wireless, fifo_tx_wireless; void wireless_m_init(){ switch (fifo_init(&fifo_rx_wireless, fifo_rx_buffer, WIRELESS_RX_BUFFER_SIZE) & fifo_init(&fifo_tx_wireless, fifo_tx_buffer, WIRELESS_TX_BUFFER_SIZE)){ case FIFO_OK: usart_serial_init(WIRELESS_USART_BASE, &WIRELESS_SERIAL_OPTIONS); WIRELESS_USART.CTRLA = WIRELESS_IRQ_LEVEL << USART_RXCINTLVL_gp; case FIFO_ERROR: return NULL; break; } } void send_wireless_command(char *command){ uint8_t len = strlen(command); while (len) { switch (fifo_push_uint8(&fifo_tx_wireless, *command)){ case FIFO_OK: len--; command++; break; case FIFO_ERROR_OVERFLOW: break; } } uint8_t status = fifo_push_uint8(&fifo_tx_wireless, '\r'); // enable transmission ISR WIRELESS_USART.CTRLA |= WIRELESS_IRQ_LEVEL << USART_DREINTLVL_gp; } char *get_wireless_response(){ uint8_t size = fifo_get_used_size(&fifo_rx_wireless); char rxBuffer[size]; if(size == 0){ return NULL; } else { for (int i=0;i
I've verified that the FIFO buffer is pushed and values can be pulled. In debugging, it "appears" that when breaks are applied to the ISR it does fire, but I am not getting anything transmitted or received. I'm sure it's simple, but I've been in the forest so long that I can't see the trees.
Thank you for your time.