I'm trying to use UART0 to transmit from the BF358F EZ KIT to a PC with the following settings: 8 data bits, 1 stop bit, no parity, LSB first and a baud rate calculated as: baud rate = sclk/(16 * divisor), where 1< divisor < 65536.
I've gone through the hardware reference manual and found the UART registers and what i thought i needed to set each to (code is shown at the bottom of this post). One confusing part for me was the DLAB bit under UARTx_LCR. The manual says setting it to 1 enables access to UARTx_DLL and DLH, while setting it to 0 enables access to THR, RBR, and IER. In my code i initally set it to 1 and then set the DLL and DLH registers (which control the divisor to set the baud rate). Then later i set DLAB to 0 so that i can write to the THR register to transmit. Am i doing this correctly?
Another possible problem for me could be on the EZ KIT. I have a USB to RS232 connector to go to my computer (with hyperterminal) from the EZ KIT. SW4 controls the connections to the RS232 header on the EZ KIT, shown below in a screenshot from the ADSP-BF538F EZ-KIT Lite Evaluation System Manual.
From here it looks like TX0 does not depend on SW4, and if i want to recieve over UART i would need SW4 pin 2 to be ON to send RX0 through to the RS232 header. And for my application the others shouldnt matter (I currently have all of them on except for pin 4). Is this right?
Or could i be missing some #include file for UART?
I dont see anything on hyperterminal when I run this code, and I'm not sure why. Thanks for the help!