Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Accessing registers/interrupts
25-05-2015, 11:38 AM,
#15
RE: Accessing registers/interrupts
Hi,

I have 2 issues I am currently facing may be you can help me:


Issue 1:

Reading out the receive buffer of I2C bus 2.

Currently, I want to connect my Raspberry Pi B+ to the PIC32MX220, which works quite good since they find each other and the RPI can write to receive buffer indicated by a green LED blinking when data has been written to the receive buffer. The problem is now to read out this buffer and my guess would be just assigning the I2C2RCV to a variable (see code below). I found code examples in the web, where this syntax has been used, but the compiler does't like this.

Here is the link with the code example:
http://hades.mech.northwestern.edu/index...een_PIC32s

Here the stdout:
Code:
if exist C:\pinguino-11\user\source\main32.o @del C:\pinguino-11\user\source\main32.o
if exist C:\pinguino-11\user\source\main32.elf @del C:\pinguino-11\user\source\main32.elf
if exist C:\pinguino-11\user\source\main32.hex @del C:\pinguino-11\user\source\main32.hex
if exist C:\pinguino-11\user\source\obj\non-free\processor.o @del C:\pinguino-11\user\source\obj\non-free\processor.o
C:\pinguino-11\compilers\p32\bin\p32-gcc.exe -march=m4k -EL -msoft-float -nostdlib -static -O3 -minterlink-mips16 -ffunction-sections -fdata-sections -Wl,--gc-sections -Wl,-LC:\pinguino-11\user\source\obj\non-free -Wl,--defsym,_min_heap_size=512 -Wl,-Map=C:\pinguino-11\user\source\output.map -D __PIC32MX__ -D __32MX220F032D__ -D PIC32_PINGUINO_220 -TC:\pinguino-11\p32\lkr\32MX220F032D.ld -TC:\pinguino-11\p32\lkr\elf32pic32mx.x -LC:\pinguino-11\user\source\obj\non-free\usb -lm -lgcc -lc -fdollars-in-identifiers -IC:\pinguino-11\p32\include\non-free -IC:\pinguino-11\p32\include\pinguino\core -IC:\pinguino-11\p32\include\pinguino\libraries -IC:\pinguino-11\p32\lkr -IC:/Users/-/Documents/Dies_und_das/PIC32_PINGUINO_MX220/dobby -IC:\pinguino-11\user\source\obj\non-free -mips16 -S -o C:\pinguino-11\user\source\main32.S C:\pinguino-11\user\source\main32.c
C:\pinguino-11\compilers\p32\bin\p32-gcc.exe -march=m4k -EL -msoft-float -nostdlib -static -O3 -minterlink-mips16 -ffunction-sections -fdata-sections -Wl,--gc-sections -Wl,-LC:\pinguino-11\user\source\obj\non-free -Wl,--defsym,_min_heap_size=512 -Wl,-Map=C:\pinguino-11\user\source\output.map -D __PIC32MX__ -D __32MX220F032D__ -D PIC32_PINGUINO_220 -TC:\pinguino-11\p32\lkr\32MX220F032D.ld -TC:\pinguino-11\p32\lkr\elf32pic32mx.x -LC:\pinguino-11\user\source\obj\non-free\usb -lm -lgcc -lc -fdollars-in-identifiers -IC:\pinguino-11\p32\include\non-free -IC:\pinguino-11\p32\include\pinguino\core -IC:\pinguino-11\p32\include\pinguino\libraries -IC:\pinguino-11\p32\lkr -IC:/Users/-/Documents/Dies_und_das/PIC32_PINGUINO_MX220/dobby -IC:\pinguino-11\user\source\obj\non-free -mips16 -E C:\pinguino-11\user\source\main32.c > C:\pinguino-11\user\source\main32.pp
C:\pinguino-11\compilers\p32\bin\p32-gcc.exe -march=m4k -EL -msoft-float -nostdlib -static -O3 -minterlink-mips16 -ffunction-sections -fdata-sections -Wl,--gc-sections -Wl,-LC:\pinguino-11\user\source\obj\non-free -Wl,--defsym,_min_heap_size=512 -Wl,-Map=C:\pinguino-11\user\source\output.map -D __PIC32MX__ -D __32MX220F032D__ -D PIC32_PINGUINO_220 -TC:\pinguino-11\p32\lkr\32MX220F032D.ld -TC:\pinguino-11\p32\lkr\elf32pic32mx.x -LC:\pinguino-11\user\source\obj\non-free\usb -lm -lgcc -lc -fdollars-in-identifiers -IC:\pinguino-11\p32\include\non-free -IC:\pinguino-11\p32\include\pinguino\core -IC:\pinguino-11\p32\include\pinguino\libraries -IC:\pinguino-11\p32\lkr -IC:/Users/-/Documents/Dies_und_das/PIC32_PINGUINO_MX220/dobby -IC:\pinguino-11\user\source\obj\non-free -mips16 -c -g -Wa,-a,-ad C:\pinguino-11\user\source\main32.c > C:\pinguino-11\user\source\main32.lst
C:\Users\-\AppData\Local\Temp\ccspqKZc.s: Assembler messages:
C:\Users\-\AppData\Local\Temp\ccspqKZc.s:10864: Error: internal error: fixup not contained within frag
C:\Users\-\AppData\Local\Temp\ccspqKZc.s:10970: Error: internal error: fixup not contained within frag
make: *** [compile] Error 1

Issue 2:

Modifing the PIC slave address.

I would like to use an individual slave address without using the slave address masking, where bits just set to don't care. Due to the informations in the datasheet (p.174) it should be possible to write to the I2CxADD register, but an assignment like
Code:
I2C2ADD = 0x0E;
will be ignored. It still responds to the default address. Has anyone tried this before or can verify that it should work?


For completeness here my code:
Code:
#include <i2c.c>

#define PIC_ADDR 0x0E

void blinkGreen(void)
{
digitalWrite(13, HIGH);
delay(1000);
digitalWrite(13, LOW);
delay(1000);
}

void blinkRed(void)
{
digitalWrite(9, HIGH);
delay(1000);
digitalWrite(9, LOW);
delay(1000);
}

void setup() {
   CDC.getKey();
//    I2C.init(I2C2, I2C_SLAVE_MODE, I2C_100KHZ);
   I2C_slave(I2C2,PIC_ADDR);
   I2C2ADD = PIC_ADDR;        //<---- seems to be ignored
   I2C2MSK = 0;
   pinMode(13, OUTPUT);
   pinMode(9, OUTPUT);
   digitalWrite(13, LOW);
   digitalWrite(9, LOW);
}

void loop() {
   if (I2C2STATbits.D_A) {
       u8 data;
       if (I2C2STATbits.RBF){
       data = I2C2RCV;        //<---- Produce the error
       blinkGreen();
       }
   }
   else blinkRed();

}
Reply


Messages In This Thread
Accessing registers/interrupts - by Dobby_ - 29-03-2015, 04:10 PM
RE: Accessing registers/interrupts - by pingotg - 29-03-2015, 09:20 PM
RE: Accessing registers/interrupts - by Dobby_ - 30-03-2015, 07:44 PM
RE: Accessing registers/interrupts - by pingotg - 31-03-2015, 05:03 PM
RE: Accessing registers/interrupts - by moreno - 31-03-2015, 06:11 PM
RE: Accessing registers/interrupts - by Dobby_ - 31-03-2015, 08:15 PM
RE: Accessing registers/interrupts - by moreno - 31-03-2015, 09:33 PM
RE: Accessing registers/interrupts - by joel - 01-04-2015, 06:54 PM
RE: Accessing registers/interrupts - by Dobby_ - 01-04-2015, 10:03 PM
RE: Accessing registers/interrupts - by Dobby_ - 01-04-2015, 08:57 PM
RE: Accessing registers/interrupts - by joel - 02-04-2015, 10:42 AM
RE: Accessing registers/interrupts - by Dobby_ - 02-04-2015, 09:22 PM
RE: Accessing registers/interrupts - by pingotg - 02-04-2015, 10:15 PM
RE: Accessing registers/interrupts - by Dobby_ - 07-04-2015, 10:09 PM
RE: Accessing registers/interrupts - by Dobby_ - 25-05-2015, 11:38 AM
RE: Accessing registers/interrupts - by regis - 28-05-2015, 09:42 AM
RE: Accessing registers/interrupts - by Dobby_ - 30-05-2015, 12:31 PM
RE: Accessing registers/interrupts - by regis - 01-06-2015, 12:40 PM
RE: Accessing registers/interrupts - by Dobby_ - 04-06-2015, 08:42 AM
RE: Accessing registers/interrupts - by regis - 04-06-2015, 11:30 AM
RE: Accessing registers/interrupts - by Dobby_ - 04-06-2015, 06:09 PM
RE: Accessing registers/interrupts - by regis - 08-06-2015, 12:31 PM
RE: Accessing registers/interrupts - by Dobby_ - 13-06-2015, 05:55 PM
RE: Accessing registers/interrupts - by regis - 13-06-2015, 06:15 PM
RE: Accessing registers/interrupts - by Dobby_ - 13-06-2015, 09:59 PM
RE: Accessing registers/interrupts - by fpeixeiro - 29-09-2016, 04:31 PM

Forum Jump:


Users browsing this thread: 1 Guest(s)