 |
 |
View previous topic :: View next topic |
Author |
Message |
temtronic
Joined: 01 Jul 2010 Posts: 9569 Location: Greensville,Ontario
|
|
Posted: Tue Jul 22, 2025 4:56 am |
|
|
Reading any file is easy, you open the file, read a record, increment a counter, read the next , repeat...until end of file. Same for .bmp as it is for .txt files
However I suspect you actually want to DISPLAY an image stored as a .bmp file ? |
|
 |
ilker07
Joined: 03 Jun 2022 Posts: 74
|
|
Posted: Wed Jul 23, 2025 6:02 am |
|
|
void bmp_draw(char *filename) {
FILE myfile;
unsigned int8 header[BMP_HEADER_SIZE];
unsigned int32 width, height, dataOffset;
unsigned int32 rowSize, padding;
unsigned int16 x, y;
unsigned int16 r, g, b;
if (fatopen(filename, "rb", &myfile) != 0) {
fprintf(SCREEN, "BMP OPEN ERROR\n");
return;
}
fatseek(&myfile, 0, SEEK_SET);
// BMP header
for (int i = 0; i < BMP_HEADER_SIZE; i++) {
int ch = fatgetc(&myfile);
fprintf(SCREEN,"%c ",ch);
if (ch == EOF) {
fprintf(SCREEN, "BMP HEADER READ ERROR\n");
fatclose(&myfile);
return;
}
header[i] = (unsigned char)ch;
}
fprintf(SCREEN,"\n ");
// ("BM")
if (header[0] != 'B' || header[1] != 'M') {
fprintf(SCREEN, "NOT A BMP FILE\n");
fatclose(&myfile);
return;
}
unsigned int32 val0,val1,val2,val3,val4,val5,val6,val7,val8,val9,val10,val11;
val0=header[18];
val1=header[19];
val1=val1<<8;
val2=header[20];
val2=val2<<16;
val3=header[21];
val3=val3<<24;
val4=header[10];
val5=header[11];
val5=val5<<8;
val6=header[12];
val6=val6<<16;
val7=header[13];
val7=val7<<24;
val8=header[22];
val9=header[23];
val9=val9<<8;
val10=header[24];
val10=val10<<16;
val11=header[25];
val11=val11<<24;
dataOffset = val4 | val5 | val6 | val7;
width = val0 | val1 | val2 | val3;
height = val8 | val9 | val10 | val11;
rowSize = (width * 3 + 3) ;
unsigned int32 temp;
temp= (~3);
rowSize=rowSize & 0xFFFFFFFCUL;
padding = rowSize - (width * 3);
fatseek(&myfile, dataOffset, SEEK_SET);
for (y = 0; y < height; y++) {
for (x = 0; x < width; x++) {
b = fatgetc(&myfile);
g = fatgetc(&myfile);
r = fatgetc(&myfile);
if (b == EOF || g == EOF || r == EOF) {
fprintf(SCREEN, "BMP PIXEL READ ERROR\n");
fatclose(&myfile);
return;
}
// RGB888 › RGB565
unsigned int16 color = ((r & 0xF8) << 8) |
((g & 0xFC) << 3) |
(b >> 3);
drawPixel(x, height - 1 - y, color);
}
// i padding bytes
for (unsigned int p = 0; p < padding; p++) {
if (fatgetc(&myfile) == EOF) {
fatclose(&myfile);
return;
}
}
}
fatclose(&myfile);
}
I can do this with this way but it is too slow .What can I do?? |
|
 |
ilker07
Joined: 03 Jun 2022 Posts: 74
|
|
Posted: Wed Jul 30, 2025 2:48 am |
|
|
in main.c
#use delay(clock=80000000,crystal=20000000)
in mmcsd_m.c
MMCSD_err mmcsd_init()
{
setup_timer_2(T2_DIV_BY_16, 1, 1);//for spi clock
uint8_t
i,
r1,
r3[4];
g_CRC_enabled = TRUE;
g_mmcsdBufferAddress = 0;
output_drive(MMCSD_PIN_SELECT);
#ifdef MMCSD_SPI_HW
setup_spi(SPI_MASTER | SPI_H_TO_L | SPI_CLK_T2 | SPI_XMIT_L_TO_H);
.......
with this way,it does not work...
in main.c
#use delay(internal=16000000) it draws bmp file in 70 seconds?? |
|
 |
temtronic
Joined: 01 Jul 2010 Posts: 9569 Location: Greensville,Ontario
|
|
Posted: Wed Jul 30, 2025 5:11 am |
|
|
Curious, downloaded the 18f67k22 datasheet...
I'm surprised you don't get an error message about the clock speed.
a 67k22 max clock is 64MHz.
you should get into the habit of adding //comments at the end of most lines of code. Makes it easier for everyone to understand what you're trying to do. |
|
 |
gaugeguy
Joined: 05 Apr 2011 Posts: 332
|
|
Posted: Wed Jul 30, 2025 6:08 am |
|
|
Also the input of the PLL is only rated for 4MHz to 16MHz.
Do not attempt to overclock. |
|
 |
ilker07
Joined: 03 Jun 2022 Posts: 74
|
|
Posted: Wed Jul 30, 2025 7:03 am |
|
|
gaugeguy wrote: | Also the input of the PLL is only rated for 4MHz to 16MHz.
Do not attempt to overclock. |
when I use #use delay(internal=16MHz) ,I get same result...
setAddressWindow(startX, startY, width-1, height-1); //0, 0, 479, 319
PORTD &= ~(1 << 4);
PORTD |= (1 << 3);
for (y = 0; y < height; y++) { //320
for (x = 0; x < width; x++) { //480
b = fatgetc(&myfile);
g = fatgetc(&myfile);
r = fatgetc(&myfile);
unsigned int16 color = ((r & 0xF8) << 8) | ((g & 0xFC) << 3) |(b >> 3);
unsigned char high_byte = (color >> 8) & 0xFF;
unsigned char low_byte = color & 0xFF;
write_bus(high_byte);
PORTD &= ~(1 << 2);
PORTD |= (1 << 2);
write_bus(low_byte);
PORTD &= ~(1 << 2);
PORTD |= (1 << 2);
}
for (unsigned int16 p = 0; p < padding; p++) {fatgetc(&myfile);}
}
PORTD |= (1 << 4);
///*********************************
mmcsd_m.c
MMCSD_err mmcsd_init()
{
//setup_timer_2(T2_DIV_BY_4, 24, 1);//625 khz timer cikisi bunun yarisi spi icin
uint8_t
i,
r1,
r3[4];
g_CRC_enabled = TRUE;
g_mmcsdBufferAddress = 0;
output_drive(MMCSD_PIN_SELECT);
#ifdef MMCSD_SPI_HW
setup_spi(SPI_MASTER | SPI_H_TO_L | SPI_CLK_DIV_64 | SPI_XMIT_L_TO_H);//SPI_CLK_T2 SPI_CLK_DIV_64
/*
#else // Software SPI
output_drive(MMCSD_PIN_SCK);
output_drive(MMCSD_PIN_SDO);
output_float(MMCSD_PIN_SDI);
*/
#endif
mmcsd_deselect();
delay_ms(250);
for(i = 0; i < 10; i++) // Send 80 cycles
MMCSD_SPI_XFER(0xFF);
/* begin initialization */
i = 0;
do
{
delay_ms(1);
mmcsd_select();
r1 = mmcsd_go_idle_state();
mmcsd_deselect();
i++;
if(i == 0xFF) {
if (r1 == 0)
return 1;
else
return r1;
}
} while(r1 != MMCSD_IDLE);
i = 0;
do
{
delay_ms(1);
mmcsd_select();
r1 = mmcsd_send_op_cond();
mmcsd_deselect();
i++;
} while((r1 & MMCSD_IDLE) && i != 0xFF);
if(i == 0xFF) {
delay_ms(100);
mmcsd_select();
r1 = mmcsd_go_idle_state();
mmcsd_deselect();
delay_ms(100);
mmcsd_select();
r1 = mmcsd_send_if_cond(r3);
mmcsd_deselect();
if(r1 != MMCSD_IDLE)
return r1;
}
/* figure out if we have an SD or MMC */
i = 0;
do {
mmcsd_select();
r1=mmcsd_app_cmd();
r1=mmcsd_sd_send_op_cond();
mmcsd_deselect();
delay_ms(100);
i++;
} while((r1 == MMCSD_IDLE) && (i != 0xFF));
if(r1 == MMCSD_IDLE)
return r1;
/* an mmc will return an 0x04 here */
if(r1 == 0x04)
g_card_type = MMC;
else {
g_card_type = SDSC;
mmcsd_select();
r1 = mmcsd_read_ocr(r3);
mmcsd_deselect();
if(r1 != MMCSD_ILLEGAL_CMD) {
r1 = r3[3];
if(bit_test(r1, 6)) // If bit 30 of the OCR register is 1 (CCS is 1) ==> SDHC type
g_card_type = SDHC;
}
}
/* set block length to 512 bytes */
mmcsd_select();
r1 = mmcsd_set_blocklen(MMCSD_MAX_BLOCK_SIZE);
mmcsd_deselect();
if(r1 != MMCSD_GOODEC)
return r1;
/// this would be a good time to set a higher clock speed, 20MHz
#ifdef MMCSD_SPI_HW
setup_spi(SPI_MASTER | SPI_H_TO_L | SPI_XMIT_L_TO_H | SPI_CLK_DIV_4);
#else
//#use spi(MASTER, DI=MMCSD_PIN_SDI, DO=MMCSD_PIN_SDO, CLK=MMCSD_PIN_SCK, BITS=8, MODE=3,baud=10000000) //
#use SPI(MASTER, SPI1, BITS=8, MODE=3,baud=20000000,STREAM=SDCARD) //
#endif
// Turn OFF CRC check, some card return 0 (MMCSD_GOODEC) and some others return 0x04 (MMCSD_ILLEGAL_CMD)
mmcsd_select();
r1 = mmcsd_crc_on_off(FALSE);
mmcsd_deselect();
r1 = mmcsd_load_buffer();
return MMCSD_GOODEC;
} |
|
 |
ilker07
Joined: 03 Jun 2022 Posts: 74
|
|
Posted: Wed Jul 30, 2025 7:05 am |
|
|
temtronic wrote: | Curious, downloaded the 18f67k22 datasheet...
I'm surprised you don't get an error message about the clock speed.
a 67k22 max clock is 64MHz.
you should get into the habit of adding //comments at the end of most lines of code. Makes it easier for everyone to understand what you're trying to do. |
I used this way so many times by overclocking |
|
 |
temtronic
Joined: 01 Jul 2010 Posts: 9569 Location: Greensville,Ontario
|
|
Posted: Wed Jul 30, 2025 7:18 am |
|
|
Keep overclocking the PIC and it'll turn into a brick, you'll have to toss out.
In the meantime, many peripherals aren't rated for that speed and of course PCB design HAS to be 100% designed and made for that speed. |
|
 |
ilker07
Joined: 03 Jun 2022 Posts: 74
|
|
Posted: Wed Jul 30, 2025 8:40 am |
|
|
temtronic wrote: | Keep overclocking the PIC and it'll turn into a brick, you'll have to toss out.
In the meantime, many peripherals aren't rated for that speed and of course PCB design HAS to be 100% designed and made for that speed. |
right now I use interal 16 mhz |
|
 |
temtronic
Joined: 01 Jul 2010 Posts: 9569 Location: Greensville,Ontario
|
|
Posted: Wed Jul 30, 2025 1:00 pm |
|
|
these...
unsigned char high_byte = (color >> 8) & 0xFF;
unsigned char low_byte = color & 0xFF;
.. look wrong.
CCS C treas 'char' as an unsigned integer.
while not a real 'problem', I have to wonder AI 'created' the program ?
Lack of comments doesn't help.
Maybe post what the current problem is ! |
|
 |
ilker07
Joined: 03 Jun 2022 Posts: 74
|
|
Posted: Wed Jul 30, 2025 3:08 pm |
|
|
It draws the bmp file very well but in 80 seconds!! lookslike spi speed around 100khz |
|
 |
temtronic
Joined: 01 Jul 2010 Posts: 9569 Location: Greensville,Ontario
|
|
Posted: Wed Jul 30, 2025 4:04 pm |
|
|
you don't show your complete program but there are a lot of delays, including a 100ms one in what you post.
I suggest you break it down into 2 parts
1) setup / init the SDcard...
2) read the datafile.bmp but do NOT doing any 'processing'.Just read a record, loop until all read in.
time #2, see if it takes 80 seconds
SPI speed should be faster but can't tell how you're really configured it. |
|
 |
ilker07
Joined: 03 Jun 2022 Posts: 74
|
|
Posted: Thu Jul 31, 2025 12:28 am |
|
|
main.c
#include <18F67K22.h>
#device PASS_STRINGS = IN_RAM
#use delay(internal=16MHz)
#FUSES NOWDT
#FUSES WDT128
#FUSES NOXINST
#FUSES NOBROWNOUT
#FUSES PROTECT
#FUSES NOMCLR
// TFT Pinleri
#define TFT_D0 PIN_F1
#define TFT_D1 PIN_E7
#define TFT_D2 PIN_F7
#define TFT_D3 PIN_F6
#define TFT_D4 PIN_F5
#define TFT_D5 PIN_F4
#define TFT_D6 PIN_F3
#define TFT_D7 PIN_F2
#define TFT_RST PIN_E0
#define TFT_CS PIN_D4
#define TFT_RS PIN_D3
#define TFT_WR PIN_D2
#define TFT_RD PIN_C0
#define BMP_HEADER_SIZE 54
//#pragma use rs232(baud=19200, xmit=PIN_G1, rcv=PIN_G2, stream=SCREEN, errors)
#define MMCSD_SPI_HW
#define MMCSD_PIN_SCK PIN_C3 //o
#define MMCSD_PIN_SDI PIN_C4 //i
#define MMCSD_PIN_SDO PIN_C5 //o
#define MMCSD_PIN_SELECT PIN_E1 //o
#include <mmcsd_m.c>
#include <fat_m.c>
#use fast_io(D)
#use fast_io(C)
#byte PORTC = 0xF82
#byte PORTD = 0xF8C
#byte PORTE = 0xF84
#byte PORTF = 0xF85
void setAddressWindow(unsigned int16 x0, unsigned int16 y0, unsigned int16 x1, unsigned int16 y1);
void write_bus(unsigned char data);
void tft_pins_init() {
set_tris_f(0x00);
set_tris_e(0x00);
set_tris_d(0x00);
output_drive(PIN_C0);
}
void write_bus(unsigned char data) { // 07 E0 0000 0111 1110 0000 1111 1000 0000 0000
if(data & 0x01)
PORTF |= (1 << 1);
else
PORTF &= ~(1 << 1);
if(data & 0x02)
PORTE |= (1 << 7);
else
PORTE &= ~(1 << 7);
if(data & 0x04)
PORTF |= (1 << 7);
else
PORTF &= ~(1 << 7);
if(data & 0x08)
PORTF |= (1 << 6);
else
PORTF &= ~(1 << 6);
if(data & 0x10)
PORTF |= (1 << 5);
else
PORTF &= ~(1 << 5);
if(data & 0x20)
PORTF |= (1 << 4);
else
PORTF &= ~(1 << 4);
if(data & 0x40)
PORTF |= (1 << 3);
else
PORTF &= ~(1 << 3);
if(data & 0x80)
PORTF |= (1 << 2);
else
PORTF &= ~(1 << 2);
}
void tft_write_command(unsigned char cmd) {
PORTD &= ~(1 << 4);
PORTD &= ~(1 << 3);
write_bus(cmd);
PORTD &= ~(1 << 2);
PORTD |= (1 << 2);
PORTD |= (1 << 4);
}
void tft_write_data(unsigned char data) {
PORTD &= ~(1 << 4);
PORTD |= (1 << 3);
write_bus(data);
PORTD &= ~(1 << 2);
PORTD |= (1 << 2);
PORTD |= (1 << 4);
}
void tft_reset() {
output_low(TFT_RST);
delay_ms(20);
output_high(TFT_RST);
delay_ms(150);
}
void tft_init() {
tft_reset();
tft_write_command(0x01); // Software Reset
delay_ms(120);
tft_write_command(0x11); // Sleep Out
delay_ms(120);
tft_write_command(0x3A); // Interface Pixel Format
tft_write_data(0x55); // 16-bit/pixel RGB565
tft_write_command(0x36);//rotation
tft_write_data(0xA8); //0X28
tft_write_command(0x29); // Display ON
delay_ms(20);
}
void setAddressWindow(unsigned int16 x0, unsigned int16 y0, unsigned int16 x1, unsigned int16 y1) {
tft_write_command(0x2A); // Column Address Set
tft_write_data(x0 >> 8);
tft_write_data(x0 & 0xFF);
tft_write_data(x1 >> 8);
tft_write_data(x1 & 0xFF);
tft_write_command(0x2B); // Row Address Set
tft_write_data(y0 >> 8);
tft_write_data(y0 & 0xFF);
tft_write_data(y1 >> 8);
tft_write_data(y1 & 0xFF);
tft_write_command(0x2C); // Memory Write
}
void tft_fill_color(unsigned int16 color) {
unsigned char high_byte = (color >> 8) & 0xFF;
unsigned char low_byte = color & 0xFF;
setAddressWindow(0, 0, 479, 319);
output_low(TFT_CS);output_high(TFT_RS);
unsigned int16 y,x;
for (y = 0; y < 320; y++) {
for (x = 0; x < 480; x++) {
write_bus(high_byte);
output_low(TFT_WR);
output_high(TFT_WR);
write_bus(low_byte);
output_low(TFT_WR);
output_high(TFT_WR);
}
}
output_high(TFT_CS);
}
void bmp_draw(char *filename,unsigned int16 startX,unsigned int16 startY) {
FILE myfile;
unsigned int8 header[BMP_HEADER_SIZE];
unsigned int32 width, height, dataOffset;
unsigned int32 rowSize, padding;
unsigned int16 x, y;
unsigned int16 r, g, b;
if (fatopen(filename, "rb", &myfile) != 0) {
// fprintf(SCREEN, "BMP OPEN ERROR\n");
return;
}
fatseek(&myfile, 0, SEEK_SET);
// BMP header
for (int i = 0; i < BMP_HEADER_SIZE; i++) {
int ch = fatgetc(&myfile);
//fprintf(SCREEN,"%c ",ch);
if (ch == EOF) {
// fprintf(SCREEN, "BMP HEADER READ ERROR\n");
fatclose(&myfile);
return;
}
header[i] = (unsigned char)ch;
}
//fprintf(SCREEN,"\n ");
// BMP type control ("BM")
if (header[0] != 'B' || header[1] != 'M') {
// fprintf(SCREEN, "NOT A BMP FILE\n");
fatclose(&myfile);
return;
}
unsigned int32 val0,val1,val2,val3,val4,val5,val6,val7,val8,val9,val10,val11;
val0=header[18];
val1=header[19];
val1=val1<<8;
val2=header[20];
val2=val2<<16;
val3=header[21];
val3=val3<<24;
val4=header[10];
val5=header[11];
val5=val5<<8;
val6=header[12];
val6=val6<<16;
val7=header[13];
val7=val7<<24;
val8=header[22];
val9=header[23];
val9=val9<<8;
val10=header[24];
val10=val10<<16;
val11=header[25];
val11=val11<<24;
dataOffset = val4 | val5 | val6 | val7;
width = val0 | val1 | val2 | val3;
height = val8 | val9 | val10 | val11;
rowSize = (width * 3 + 3) ;
rowSize=rowSize & 0xFFFFFFFCUL;
padding = rowSize - (width * 3);
// fprintf(SCREEN,"width:%lu height:%lu rowSize:%lu padding:%lu ",width,height,rowSize,padding);
fatseek(&myfile, dataOffset, SEEK_SET);
setAddressWindow(startX, startY, width-1, height-1); //0, 0, 479, 319
PORTD &= ~(1 << 4);//cs low
PORTD |= (1 << 3);
for (y = 0; y < height; y++) { //320
for (x = 0; x < width; x++) { //480
b = fatgetc(&myfile);
g = fatgetc(&myfile);
r = fatgetc(&myfile);
unsigned int16 color = ((r & 0xF8) << 8) | ((g & 0xFC) << 3) |(b >> 3);
unsigned char high_byte = (color >> 8) & 0xFF;
unsigned char low_byte = color & 0xFF;
write_bus(high_byte);
PORTD &= ~(1 << 2);
PORTD |= (1 << 2);
write_bus(low_byte);
PORTD &= ~(1 << 2);
PORTD |= (1 << 2);
}
for (unsigned int16 p = 0; p < padding; p++) {fatgetc(&myfile);}
}
PORTD |= (1 << 4); //cs pin
fatclose(&myfile);
}
void main(void) {
tft_pins_init();
output_low(PIN_E3);
output_high(TFT_CS);
output_high(TFT_WR);
output_high(TFT_RD);
output_high(TFT_RST);
tft_init();
tft_fill_color(0x001F);//blue
signed int8 i=0;
i = fat_init();
if(i!=0) output_high(PIN_E3);
delay_ms(100);
bmp_draw("/mainPage.bmp",0,0);
delay_ms(3000);
bmp_draw("/runGreen.bmp",0,189);
while(TRUE) {
}
}
//*******************************************************
//******************************************************
mmcsd_m.c
MMCSD_err mmcsd_init()
{
//setup_timer_2(T2_DIV_BY_4, 24, 1);// timer output
uint8_t
i,
r1,
r3[4];
g_CRC_enabled = TRUE;
g_mmcsdBufferAddress = 0;
output_drive(MMCSD_PIN_SELECT);
#ifdef MMCSD_SPI_HW
setup_spi(SPI_MASTER | SPI_H_TO_L | SPI_CLK_DIV_64 | SPI_XMIT_L_TO_H);//SPI_CLK_T2 SPI_CLK_DIV_64
/*
#else // Software SPI
output_drive(MMCSD_PIN_SCK);
output_drive(MMCSD_PIN_SDO);
output_float(MMCSD_PIN_SDI);
*/
#endif
mmcsd_deselect();
delay_ms(250);
for(i = 0; i < 10; i++) // Send 80 cycles
MMCSD_SPI_XFER(0xFF);
/* begin initialization */
i = 0;
do
{
delay_ms(1);
mmcsd_select();
r1 = mmcsd_go_idle_state();
mmcsd_deselect();
i++;
if(i == 0xFF) {
if (r1 == 0)
return 1;
else
return r1;
}
} while(r1 != MMCSD_IDLE);
i = 0;
do
{
delay_ms(1);
mmcsd_select();
r1 = mmcsd_send_op_cond();
mmcsd_deselect();
i++;
} while((r1 & MMCSD_IDLE) && i != 0xFF);
if(i == 0xFF) {
delay_ms(100);
mmcsd_select();
r1 = mmcsd_go_idle_state();
mmcsd_deselect();
delay_ms(100);
mmcsd_select();
r1 = mmcsd_send_if_cond(r3);
mmcsd_deselect();
if(r1 != MMCSD_IDLE)
return r1;
}
/* figure out if we have an SD or MMC */
i = 0;
do {
mmcsd_select();
r1=mmcsd_app_cmd();
r1=mmcsd_sd_send_op_cond();
mmcsd_deselect();
delay_ms(100);
i++;
} while((r1 == MMCSD_IDLE) && (i != 0xFF));
if(r1 == MMCSD_IDLE)
return r1;
/* an mmc will return an 0x04 here */
if(r1 == 0x04)
g_card_type = MMC;
else {
g_card_type = SDSC;
mmcsd_select();
r1 = mmcsd_read_ocr(r3);
mmcsd_deselect();
if(r1 != MMCSD_ILLEGAL_CMD) {
r1 = r3[3];
if(bit_test(r1, 6)) // If bit 30 of the OCR register is 1 (CCS is 1) ==> SDHC type
g_card_type = SDHC;
}
}
/* set block length to 512 bytes */
mmcsd_select();
r1 = mmcsd_set_blocklen(MMCSD_MAX_BLOCK_SIZE);
mmcsd_deselect();
if(r1 != MMCSD_GOODEC)
return r1;
/// this would be a good time to set a higher clock speed, 20MHz
#ifdef MMCSD_SPI_HW
setup_spi(FALSE); //DATASHEET says for re -initializing disable spi
delay_ms(100);
setup_spi(SPI_MASTER | SPI_H_TO_L | SPI_XMIT_L_TO_H | SPI_CLK_DIV_4);
#else
//#use spi(MASTER, DI=MMCSD_PIN_SDI, DO=MMCSD_PIN_SDO, CLK=MMCSD_PIN_SCK, BITS=8, MODE=3,baud=10000000) //
#use SPI(MASTER, SPI1, BITS=8, MODE=3,baud=4000000,STREAM=SDCARD) //
#endif
// Turn OFF CRC check, some card return 0 (MMCSD_GOODEC) and some others return 0x04 (MMCSD_ILLEGAL_CMD)
mmcsd_select();
r1 = mmcsd_crc_on_off(FALSE);
mmcsd_deselect();
r1 = mmcsd_load_buffer();
return MMCSD_GOODEC;
}
I think spi speed dos not change here!! |
|
 |
ilker07
Joined: 03 Jun 2022 Posts: 74
|
|
Posted: Thu Jul 31, 2025 4:43 am |
|
|
setup_spi(FALSE);
delay_ms(1000);
setup_spi(SPI_MASTER | SPI_H_TO_L | SPI_XMIT_L_TO_H | SPI_CLK_DIV_4);
Does this method change SPI speed? |
|
 |
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
Powered by phpBB © 2001, 2005 phpBB Group
|