Forum

Please consider registering
guest

Log In Register

Register | Lost password?
Advanced Search

— Forum Scope —

  

— Match —

   

— Forum Options —

   

Minimum search word length is 4 characters - maximum search word length is 84 characters

Topic RSS
Spi clock divider
2014 年 09 月 24 日
09:08:44
hippy
New Member
Forum Posts: 8
Member Since:
2014 年 08 月 07 日
Offline

Hey, could someone please explain then SPI clock registers a bit better?

I would like to get 48mhz and 33mhz, but can't figure it out.

Is a divisor or 2 = 25mhz?

Thanks,
Hippy

2014 年 09 月 24 日
16:17:45
cucubutter
Moderator
Forum Posts: 84
Member Since:
2014 年 04 月 10 日
Offline

Hello, hippy

On 86Duino, you can get SPI speed by the formula : 100MHz / (divider X 2)
And then use setClockDivider() to set SPI divider. EX: setClockDivider(10) get 5MHz, setClockDivider(25) get 2MHz ...
If want to get 48MHz and 33Mhz, try to call setClockDivider(1) and setClockDivider(2) after call begin().

cucubutter

2014 年 09 月 24 日
18:19:51
hippy
New Member
Forum Posts: 8
Member Since:
2014 年 08 月 07 日
Offline

cucubutter said

Hello, hippy

On 86Duino, you can get SPI speed by the formula : 100MHz / (divider X 2)
And then use setClockDivider() to set SPI divider. EX: setClockDivider(10) get 5MHz, setClockDivider(25) get 2MHz ...
If want to get 48MHz and 33Mhz, try to call setClockDivider(1) and setClockDivider(2) after call begin().

cucubutter

Thanks Cucubutter,
So there is no way to specify exactly 48mhz, because 100/(1 X 2) = 50?
And then 100/(2*2) = 25mhz?

I can see in the Vortex86 datasheet, the clock registers, with H, M and L nibbles. Can these be used to obtain speeds between 25mhz and 50mhz?

For my LCD screen, 25mhz is not really fast enough, but 50mhz won't work. I have read the screen can run at 48mhz, but I don't know how I can obtain that.

Many thanks,
Hippy

2014 年 09 月 24 日
20:52:19
Android_Lin
Moderator
Forum Posts: 211
Member Since:
2014 年 04 月 01 日
Offline

Hello, hippy
Like you see in 86Duino datasheet, the highest speed of SPI is 50MHz, and following is 25MHz (The speed between 25M and 50M is unavailable). These 50MHz and 25MHz just approximate to the value you need, but not exact. You may not get 48MHz or 33MHz SPI speed on 86Duino.

2014 年 09 月 24 日
21:03:58
hippy
New Member
Forum Posts: 8
Member Since:
2014 年 08 月 07 日
Offline

Android_Lin said

Hello, hippy
Like you see in 86Duino datasheet, the highest speed of SPI is 50MHz, and following is 25MHz (The speed between 25M and 50M is unavailable). These 50MHz and 25MHz just approximate to the value you need, but not exact. You may not get 48MHz or 33MHz SPI speed on 86Duino.

Hi Android_Lin!

Thanks for your reply. Can see in the datasheet the second register...

Register Offset: BASE_ADDR+06h Register Name: SPI Clock Divide High Byte Register Reset Value: 00h It is not recommended to modify this register when SPI operation. 7 6 5 4 3 2 1 0 CKDIV_H CKDIV_M Bit Name Attribute SPI clock divided high nibble. Description The SPI clock is SOURCE clock/(2 * SPI clock divided) , 0 is not allowed. H/W will 7-4 CKDIV_HR/W auto change to 1 when CKDIV_H=0, CKDIV_M=0 and CKDIV_L=0 , therefore the programming flow of set SPI clock will be write CKDIV_H and CKDIV_M first then CKDIV_L. SPI clock divided middle nibble. The SPI clock is SOURCE clock/(2 * SPI clock divided) , 0 is not allowed. H/W will 3-0 CKDIV_MR/W auto change to 1 when CKDIV_H=0, CKDIV_M=0 and CKDIV_L=0 , therefore the programming flow of set SPI clock will be write CKDIV_H and CKDIV_M first then CKDIV_L.

So we have a single 12-bit divider, and not a divider and subdivider?

So is impossible to get 48mhz, correct?

Cheers,
Hippy

2014 年 09 月 24 日
23:01:41
Android_Lin
Moderator
Forum Posts: 211
Member Since:
2014 年 04 月 01 日
Offline

hippy said
So we have a single 12-bit divider, and not a divider and subdivider?

Yes

hippy said
So is impossible to get 48mhz, correct?

You are right.

2014 年 09 月 25 日
09:44:57
hippy
New Member
Forum Posts: 8
Member Since:
2014 年 08 月 07 日
Offline

Thanks very much, looks like it's 25mhz then :l

Also, it's not mentioned in the datasheet, but it's possible to perform dma transactions with the SPI interface? There would usually be registers to set the address and size etc.
I have seen a reference to DMA on the interrupt status register.

I am also curious as to the size of the spi FIFO?

Many thanks,
Hippy

2014 年 09 月 25 日
18:09:41
Android_Lin
Moderator
Forum Posts: 211
Member Since:
2014 年 04 月 01 日
Offline

Hello,hippy
The SPI interface on Vortex86EX does not support DMA and it's FIFO size is 16 bytes.

2014 年 09 月 26 日
08:15:43
hippy
New Member
Forum Posts: 8
Member Since:
2014 年 08 月 07 日
Offline

Android_Lin said

Hello,hippy
The SPI interface on Vortex86EX does not support DMA and it's FIFO size is 16 bytes.

Thank you Android_Lin,

Very happy with the support available here, and I'm very happy with educake and Vortex86ex product, i have a ILI9341 spi display hooked up and working reasonably well with a driver i wrote for nano-x, I'll github the whole thing when it's all optimised.

Do you know if any work has been done on kernel modules for the integrated modules like MCM and spi? I'd like to continue that work, if someone has already made a start that would be good!

I've also investigated using interrupts via UIO kernel userspace io module, but have not written any code for that yet.

Cheers,
Hippy Cool

2014 年 09 月 29 日
20:52:00
Android_Lin
Moderator
Forum Posts: 211
Member Since:
2014 年 04 月 01 日
Offline

Hello, hippy,
Currently, we don't have the idea to build the driver. In the future, we will first build a 86Duino library for Linux. If now want to build a 86Duino driver, recommend to refer 86Duino source code.

2015 年 03 月 11 日
07:30:06
martinhutchins
New Member
Forum Posts: 2
Member Since:
2014 年 05 月 02 日
Offline
11

Hey Hippy,

You have made a few posts now with the tempting offer of releasing your code....

I am interested in the crossbar changes that you have made in order to bring out the hardware SPI to the breadboard on the educake, and it seems we are both interested in getting the ILI9341 LCD module working (though it sounds like you are there already!)

Any chance of a URL to your github page?

Best wishes,

Martin

2015 年 03 月 23 日
15:28:07
cucubutter
Moderator
Forum Posts: 84
Member Since:
2014 年 04 月 10 日
Offline
12

martinhutchins said

Hey Hippy,

You have made a few posts now with the tempting offer of releasing your code....

I am interested in the crossbar changes that you have made in order to bring out the hardware SPI to the breadboard on the educake, and it seems we are both interested in getting the ILI9341 LCD module working (though it sounds like you are there already!)

Any chance of a URL to your github page?

Best wishes,

Martin

HI, I try to use SPI on educake,it's susessful.
I use RX PIN0 to be MOSI, TX PIN1 to be MISO, SDA to be SCK and SCL to be CS.
so it's not UART0 and I2c on educake. I write some code on setup()

unsigned short crossbar_addr = sb_Read16(0x64)&0xfffe;
io_outpb(crossbar_addr + 0x38, 0x00);
io_outpb(crossbar_addr + 0x39, 0x00);
io_outpb(crossbar_addr + 0x18, 0x00);
io_outpb(crossbar_addr + 0x19, 0x00);
io_outpb(crossbar_addr + 0x1A, 0x00);
io_outpb(crossbar_addr + 0x1B, 0x00);
io_outpb(crossbar_addr + 0x10, 0x09);
io_outpb(crossbar_addr + 0x11, 0x0A);
io_outpb(crossbar_addr + 0x12, 0x0C);
io_outpb(crossbar_addr + 0x13, 0x0B);

for(int i=0;i<12;i++)
io_outpb(crossbar_addr + 0x90 + i, 0x08);
for(int i=0;i<16;i++)
io_outpb(crossbar_addr + 0xA0 + i, 0x08);

you can try it.

download my complete code
https://www.dropbox.com/s/nau8s7a8abaqi6u/TFTDisplayText.ino?dl=0

2015 年 06 月 11 日
09:58:31
aero_yao
New Member
Forum Posts: 1
Member Since:
2015 年 06 月 08 日
Offline
13

cucubutter said

martinhutchins said

Hey Hippy,

You have made a few posts now with the tempting offer of releasing your code....

I am interested in the crossbar changes that you have made in order to bring out the hardware SPI to the breadboard on the educake, and it seems we are both interested in getting the ILI9341 LCD module working (though it sounds like you are there already!)

Any chance of a URL to your github page?

Best wishes,

Martin

HI, I try to use SPI on educake,it's susessful.
I use RX PIN0 to be MOSI, TX PIN1 to be MISO, SDA to be SCK and SCL to be CS.
so it's not UART0 and I2c on educake. I write some code on setup()

unsigned short crossbar_addr = sb_Read16(0x64)&0xfffe;
io_outpb(crossbar_addr + 0x38, 0x00);
io_outpb(crossbar_addr + 0x39, 0x00);
io_outpb(crossbar_addr + 0x18, 0x00);
io_outpb(crossbar_addr + 0x19, 0x00);
io_outpb(crossbar_addr + 0x1A, 0x00);
io_outpb(crossbar_addr + 0x1B, 0x00);
io_outpb(crossbar_addr + 0x10, 0x09);
io_outpb(crossbar_addr + 0x11, 0x0A);
io_outpb(crossbar_addr + 0x12, 0x0C);
io_outpb(crossbar_addr + 0x13, 0x0B);

for(int i=0;i<12;i++)
io_outpb(crossbar_addr + 0x90 + i, 0x08);
for(int i=0;i<16;i++)
io_outpb(crossbar_addr + 0xA0 + i, 0x08);

you can try it.

download my complete code
https://www.dropbox.com/s/nau8s7a8abaqi6u/TFTDisplayText.ino?dl=0

Hi cucubutter
can you explain more detail regarding the Educake SPI use;
how to define the SDA pin to SCK, RX pin0 to MOSI

Forum Timezone: Asia/Taipei

Most Users Ever Online: 66

Currently Online:
1 Guest(s)

Currently Browsing this Page:
1 Guest(s)

Top Posters:

Dinosaur: 27

leutenecker: 13

mrZagg: 10

lukeross: 8

tomka: 8

smeezekitty: 8

hippy: 8

Ekkehard: 8

UIdahoCIT: 8

blaxxun: 7

Member Stats:

Guest Posters: 0

Members: 1541

Moderators: 14

Admins: 5

Forum Stats:

Groups: 2

Forums: 10

Topics: 239

Posts: 1082

Newest Members: nhollywoodmarli, bat869cube672, lenggeleranto, iknowesp, dimka, elihu, Woodrowcercraby, Robertnalty, Homerwoppy, RonaldLew

Moderators: Glaux: 70, uaa: 11, guigra: 17, asian55: 22, Android_Lin: 211, bcarroll: 12, cucubutter: 84, recycled-air: 12, stevemork: 16, zerozaber: 52, pongraczi: 20, George Andrews III: 56, poto: 11, garpastym: 20

Administrators: eveshih: 1, anthony: 31, viky6: 0, roboard: 135, hcl: 0