I am using twr k70 kinetis board,
i tried to read spi1 registers using KDS 3.2(Embsys register viewer) nothing is coming in hex and bin column of viewer.
so i tried to read and write spi registers of kinetis k70 from bootloader and also uclinux ,but as soon as i do that hardware fault comes,
i have turned on debug prints
Output :
U-Boot 2010.03 (Jul 11 2017 - 17:26:56)
U-Boot code: 2000F000 -> 2000F000 BSS: -> A63DEFDB
CPU : Freescale Kinetis series (Cortex-M4)
Freqs: SYSTICK=120MHz,CCLK=120MHz,PCLK=60MHz,MACCLK=50MHz
Board: Freescale TWR-K70F120M rev 1
RAM Configuration:
Bank #0: 70000000 128 MB
UNHANDLED EXCEPTION: HARD FAULT
R0 = 00016d50 R1 = 00000000
R2 = 01c9c380 R3 = 00000003
R12 = 00002000 LR = 0000f975
PC = 00010b1e PSR = 01000000
I am using following code to read SPI1 registers base address.
Input :
in uboot -->
u32 *p;
p=0x4002D000 ;
printf(" val at spi 1 --> %x\n" ,*(p));
in linux
int *p;
p=0x4002D000;
printf("addr ---> %p",p);
printf("val at addr ---> %x",*p);i get "segv" (segmentation fault)
According to data sheet register at address 0x4002D000 is R/W (SPI1 base register)
How to access SPI1 registers from uboot or any other peripheral register,is there any enable value ???
Thanks Now its working
I added the line for enabling the clock
u32 *simaddr = (u32 *)0x4004803C ;
*simaddr|=0x2000;
Hi Sameerarvikar,
Thanks for your response, it is good to hear it is now working.
Best Regards!
Carlos Mendoza
Technical Support Engineer
Hi Sameerarvikar,
Are you enabling the clock for the SPI module? One thing to remember is that the Embsys Register view will only display content if the peripheral is powered/clocked.
Hope it helps!
Best Regards,
Carlos Mendoza
Technical Support Engineer