cancel
Showing results for 
Search instead for 
Did you mean: 

STM32F4 Discovery FSMC problem

markmark9121
Associate II
Posted on January 08, 2013 at 03:18

I am trying to get the F4 discovery board to communicate with a FPGA board via the FSMC but I am having some problems.

I have connected the data 0-15 lines, we, oe, and addr 16-23 from the discovery to my fpga.

I can get the data to output correctly and read it on the fpga, but the problem is with the address lines.

They do not seem to be sending the address that I want them to and I don't think that I fully understand how to get them to send the address that I want.

Right now I am using the following to write data on the upper (16-23) bits of the address line.

__IO uint32_t * MYBASE4  = ((uint32_t)(0x600A0000));

I think that this should be accessing address 10 but it does not.

I write data to it with this

*MYBASE4  = 567;

This puts 567 on the data lines and the FPGA reads it correctly.

Any help on what I am missing with the address lines would be appreciated.

Dave
7 REPLIES 7
Posted on January 08, 2013 at 04:34

I might expect you see 0x5, in 16-bit mode A16 (ext) will be A17 (int) as the STM32 shifts the address (A0 being meaningless in a 16-bit context), as I recall.

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..
Posted on January 08, 2013 at 13:11

Also, there will be two consecutive writes to the same address (as A0 is unconnected), if a whole word (uint32_t) is written.

JW

markmark9121
Associate II
Posted on January 08, 2013 at 14:46

I have tried doing the following

__IO uint32_t * MYBASE7  = ((uint32_t)(0x68000000 | (10<<17)));

But I still don't see a 10 for address, but are you saying that I should also ignore A16 and start at A17 on my wiring and use a 7 bit bus?

Also how can I only do a single write and not a double (32bit) write?

Thanks

Dave
Posted on January 08, 2013 at 15:35

> But I still don't see a 10 for address,

And what do you see?

> but are you saying that I should also ignore A16 and start at A17 on my wiring and use a 7 bit bus?

No. Read the fine manual, chapter 32.4.1

> Also how can I only do a single write and not a double (32bit) write?

uint16_t *

JW

markmark9121
Associate II
Posted on January 08, 2013 at 16:18

>> But I still don't see a 10 for address,

>And what do you see?

I have not been able to get a good reading on my scope yet.

> >but are you saying that I should also ignore A16 and start at A17 on my wiring and use a 7 bit bus?

>No. Read the fine manual, chapter 32.4.1

I have read that section a few times but I am not sure what I am missing in it.

In this section it says

1. In case of a 16-bit external memory width, the FSMC will internally use HADDR[25:1] to generate the

address for external memory FSMC_A[24:0].

Whatever the external memory width (16-bit or 8-bit), FSMC_A[0] should be connected to external memory address A[0].

So I think my code should be working but I don't get what I am missing.

I cannot connect my address starting at A[0] since that is not broken out on my board.

>> Also how can I only do a single write and not a double (32bit) write?

>uint16_t *

So I should change it like this?

__IO uint16_t * MYBASE7  = ((uint16_t)(0x60000000 | (10<<16)));

I also see that a lot of LCD examples on the discovery board start with base address 0x68000000, is that because they are using something in the upper address lines to trigger some other function on the LCD?

Thanks

Dave

markmark9121
Associate II
Posted on January 09, 2013 at 02:04

Well I got it working

The following changes made everything work as I needed

Address

__IO uint32_t * FPGA = ((uint32_t)(0x60000000) | (address<<17));

Write

*FPGA = (uint16_t)data;

Dave
markmark9121
Associate II
Posted on January 09, 2013 at 02:20

Well I got it working

The following changes made everything work as I needed

Address

__IO uint32_t * FPGA = ((uint32_t)(0x60000000) | (address<<17));

Write

*FPGA = (uint16_t)data;

Dave