2011-10-17 12:30 PM
can i but 9 bits in the SPI Tx buffer configured in 8bit mode and have it still clock out all 9 bits???
2011-10-17 01:17 PM
can i but 9 bits in the SPI Tx buffer configured in 8bit mode and have it still clock out all 9 bits???
Doesn't it only support an 8 and 16-bit mode? The USART has a 9-bit mode, are you thinking about that?
2011-10-17 01:57 PM
can i but 9 bits in the SPI Tx buffer configured in 8bit mode and have it still clock out all 9 bits???
No, but SPI is dead simple to bit-bang I do not know if SPI was initially designed as 8-bit or ''any bit'' but a few people make equipment that use different bit counts and the hardware SPI makers only believe in 8 Bang those bits Erik PS if the''SPI clock rate'' is low and if you do it in a loop the overhead can be quite large, in a Timer ISR it will be reasonably efficient. If you have a 20MHz capable SPI chip a loop will do fine. PPS the 9 but UART mode is not available in mode 0(?) so only the modes creating start and stop bits (which will upset your SPI ) and do 9 bits2011-10-17 02:21 PM
Thank you Clive1 and Erik for the prompt responses.
the reason i ask is i am trying to interface yet another lcd. this one is the Nokia6100(epson)from sparkfun.i had success with this lcd in the past on the PIC 16f627a by just bit banging. however with this stm32 its not the case. screen flickers but wont draw. go figure.ive tried the bit bang routine and can verify the pins are firing but maybe to fast perhaps?(core: 72mhz, GPIO: 50/10/2)
From: malund.erikPosted: Monday, October 17, 2011 10:57 PMSubject: 9bit SPI
can i but 9 bits in the SPI Tx buffer configured in 8bit mode and have it still clock out all 9 bits???
No, but SPI is dead simple to bit-bangI do not know if SPI was initially designed as 8-bit or ''any bit'' but a few people make equipment that use different bit counts and the hardware SPI makers only believe in 8Bang those bitsErikPS if the''SPI clock rate'' is low and if you do it in a loop the overhead can be quite large, in a Timer ISR it will be reasonably efficient. If you have a 20MHz capable SPI chip a loop will do fine.PPS the 9 but UART mode is not available in mode 0(?) so only the modes creating start and stop bits (which will upset your SPI ) and do 9 bits2011-10-17 03:39 PM
@trent the max speed at which you can drive the GPIO is about 1/4 the APB speed. The speed of the IO drive basically defines how strongly the line is driven (slew rate), and the sharpness of the edges. If you need to have a slower SPI bus you'd need to spin in a loop between writing GPIO pins. Either a software loop, or counting core ticks.
@erik, SPI comes in many forms, the 8/16-bit typically has more to do with how it is buffered/staged before being output. It is possible to send out a very long stream of bits, in much the manner of scan-chains, or JTAG, where the loop length isn't known or multiple devices are chained together.2011-10-18 09:58 AM
however with this stm32 its not the case. screen flickers but wont draw. go figure.
ive tried the bit bang routine and can verify the pins are firing but maybe to fast perhaps?(core: 72mhz, GPIO: 50/10/2)
Very likely, LCDs are quite often a bit slow.
An easy test would be to insert some delay to make it run, say ~500kbits. A Nokia LCD sounds like salvage, so you probably do not have and can not get a datasheet.
Erik
Very likely, LCDs are quite often a bit slow.An easy test would be to insert some delay to make it run, say ~500kbits. A Nokia LCD sounds like salvage, so you probably do not have and can not get a datasheet.Erik
2011-10-18 10:30 AM
http://www.classic.nxp.com/acrobat_download2/datasheets/PCF8833_1.pdf
Minimum SPI clock period 150ns, so 6.667 MHz, for the Philips incarnation of the display driver. http://gnuarm.alexthegeek.com/lcd/Nokia_6100_LCD_Display_Driver.pdf Maybe you could do this using a synchronous serial mode of the USART?2011-10-26 01:06 AM
ty for your response and please excuse the delay(school stuff), clive1.
im curious how did u calculate the clock speed 6.667mhz? as for usart, i havent covered that much ground on this uC but i hope to very soon. could i just use the systick to add delays so i can get the timing more percise. as of right now, im not sure how fast they are firing. i know my board is set to 72mhz. so its 18mhz?? is this right?2011-10-26 01:14 AM
erik, ty for the response. i am working on using a oscope and tuning software delays. i have one tuned to 19.5ms+/-.5 period. maybe if i add a couple of these loops? im also thinking i could use the systick since its pretty accurate.
2011-10-26 05:52 AM
yes, any timer will do
BEWARE of loop delays in C thgey are TOTALLY unreliable Erik