Merge pull request #481 from arebert/lpc4088

[LPC4088] Corrected calculation of CAN clock and making it possible to put code in QSPI flash
pull/488/head^2
Bogdan Marinescu 2014-09-11 12:59:45 +01:00
commit 48bd3819f5
2 changed files with 5 additions and 4 deletions

View File

@ -6,7 +6,7 @@ LR_IROM1 0x00000000 0x00080000 { ; load region size_region
ER_IROM1 0x00000000 0x00080000 { ; load address = execution address ER_IROM1 0x00000000 0x00080000 { ; load address = execution address
*.o (RESET, +First) *.o (RESET, +First)
*(InRoot$$Sections) *(InRoot$$Sections)
*.o (+RO-CODE) ; forces all CODE to IFLASH *.o (+RO-CODE) ; prioritizes CODE in IFLASH before SPIFI
.ANY2 (+RO-DATA) ; prioritizes DATA in IFLASH before SPIFI .ANY2 (+RO-DATA) ; prioritizes DATA in IFLASH before SPIFI
.ANY (+RO) ; remaining RO .ANY (+RO) ; remaining RO
} }
@ -25,6 +25,7 @@ LR_IROM2 0x28000000 0x01000000 {
ER_IROM2 0x28000000 0x01000000 { ; load address = execution address ER_IROM2 0x28000000 0x01000000 { ; load address = execution address
.ANY1 (+RO-DATA) ; all DATA not fitting in IFLASH .ANY1 (+RO-DATA) ; all DATA not fitting in IFLASH
.ANY (SPIFI_MEM) ; DATA tagged as SPIFI_MEM .ANY (SPIFI_MEM) ; DATA tagged as SPIFI_MEM
*.o (SPIFI_MEM) ; CODE tagged as SPIFI_MEM
} }
} }

View File

@ -204,7 +204,7 @@ static const int timing_pts[23][2] = {
{0xF, 0x7}, // 24, 67% {0xF, 0x7}, // 24, 67%
}; };
static unsigned int can_speed(unsigned int sclk, unsigned int pclk, unsigned int cclk, unsigned char psjw) { static unsigned int can_speed(unsigned int pclk, unsigned int cclk, unsigned char psjw) {
uint32_t btr; uint32_t btr;
uint16_t brp = 0; uint16_t brp = 0;
uint32_t calcbit; uint32_t calcbit;
@ -212,7 +212,7 @@ static unsigned int can_speed(unsigned int sclk, unsigned int pclk, unsigned int
int hit = 0; int hit = 0;
int bits; int bits;
bitwidth = sclk / (pclk * cclk); bitwidth = (pclk / cclk);
brp = bitwidth / 0x18; brp = bitwidth / 0x18;
while ((!hit) && (brp < bitwidth / 4)) { while ((!hit) && (brp < bitwidth / 4)) {
@ -275,7 +275,7 @@ void can_free(can_t *obj) {
int can_frequency(can_t *obj, int f) { int can_frequency(can_t *obj, int f) {
int pclk = PeripheralClock; int pclk = PeripheralClock;
int btr = can_speed(SystemCoreClock, pclk, (unsigned int)f, 1); int btr = can_speed(pclk, (unsigned int)f, 1);
if (btr > 0) { if (btr > 0) {
uint32_t modmask = can_disable(obj); uint32_t modmask = can_disable(obj);