We are running a survey to help us improve the experience for all of our members. If you see the survey appear, please take the time to tell us about your experience if you can.
Hi,
My professor asked me to do offline processing for signal. I think for that i would only require a processor core, memory and probably a UART.
I have already built those hardware from design kit.
I wanted to write application code(in Keil) for my algorithm which takes data from memory process it and store it back into memory.
Since most of the design example(EDK) are in assembly but I m more familiar with C but addressing of peripheral and starting reset handler routine. I do not know how to write in C. I did not use CMSIS also:(
Could you suggest some thing which makes it easier
Varoius peripheral like UART and AHB2LED are given a memory space of 16 MB. it is a memory mapped I/o where each peripheral is treated as a memory address so why does it is given a 16 MB space.
I am having problem in sending data through UART. The way I am doing is
and In the main code part I am simply putting a value into that location
AHB_UART_BASE=c;
while running it is not showing the value of c. My UART in FPGA is connected to serial port on my pc. I am using AHB2UART module. Transferring data from Memory to UART that is also not working.
Hi
>>Varoius peripheral like UART and AHB2LED are given a memory space of 16 MB. it is a memory mapped I/o where each peripheral is treated as a memory address so why does it is given a 16 MB space.
The 16MB memory space is just an example, and it can customised to any size depending on your needs.
>>My UART in FPGA is connected to serial port on my pc. I am using AHB2UART module. Transferring data from Memory to UART that is also not working.
Did you define c as a char type, and is it in ASCII format?
Also if you send multiple data to UART, you need to check the UART status register to see if the FIFO is full, the address of the status register is 0x51000004, you can have a look at the verilog file for more detail.
Cheers
I have defined C as unsigned integer type. I am transferring only 4 unsigned integer values. I checked the UART module. it has a FIFO of depth 16 FIFO begin Full may not be the case.
Could you provide any study material available online for h/w development (verilog part). I searched on internet not much is available for building h/w development using cortex M0 IP core. I have implemented few of the design start example. But I am facing difficulty when I interfacing various modules for my requirement.
I am sorry for above comment not making sense.
In the above comment. I mean to say. FIFO has depth of 16 so FIFO being full might not be the case.
Have you done any simulation to check? Is it not working in simulation? or just hardware?
There are several areas to check:
- bus level integration
- baud rate (how is the system clock divided into the baud rate you expected)? What is the baud rate setting on PC?
- FPGA pin assignment
- UART connection (TX data and RX data pin definition on PC and MCU might need a cross over connection)
- The configuration of UART on your PC. Some PC don't have UART and therefore you might be using a USB to UART adaptor. Have the device driver installed sucessfully? Try a loop back connection to test.
- TTL to RS232 converter might be needed.
I guess most of the things I checked.
FPGA pin assignment ok.
-driver of UART for FPGA installed and also recognized by the PC.
-tera-term application is intalled as well.
-As specify the UART baud rate 19200. GCLK=100Mhz, HCLK=10MHZ. and baud rate=19200. with (10/19200*16)=32 as count value in baud rate generator.
In simulation I checked. I guess not worked there.
Can you post your program code?
- UART registers declarations
- How you initialize the UART
- The test sequence (how you sent data to UART)
Thanks
For a simple case I just tried to send a single value as shown.
#include "stdio.h"
#define AHB_UART_BASE (*((volatile unsigned long *)(0x51000000)))
int main ()
{
int a,b,c;
a=6;
b=5;
c=a+b;
return 0;
}
///Vector table for program.
/ Define where the top of memory is.
#define TOP_OF_RAM 0xFFC
extern int main(void); // Use C-library initialization function.
__attribute__ ((section("__Vectors")))
static void (* const vector_table[])(void) =
(void (*)(void)) TOP_OF_RAM, // Initial value for stack pointer.
(void (*)(void)) main, // Reset handler is C initialization.
0, // No HardFault handler, just cause lockup.
0, // No NMI handler, just cause lockup.
0,
0,0,0,0,0,0,0//... // Additional handlers would be listed here.
(void) UART_handler
};
Sorry for the delay.
You write the character with value of 11 (0xB) to the UART. However, this might not be a character that can be displayed on your terminal.
So please try
AHB_UART_BASE='A'; // Character 'A'
Another issue is that the main() is finished after you send out the character.
You might want to add a dead loop :
int main (void)
AHB_UART_BASE='A';
while(1); // deadloop
Hope this helps.