Hi *,
I want to use the 8 bit port XS1_PORT_8D for i2c, also for audio data out and clock input.
Bitmask:
XS1_PORT_8D = (AUDIO OUT, none, none, none, CLK IN, none, SDA, SCL)
Is this possible?
If so, how can I assign the port SDA and SCL to the i2c struct?
If not, can I split up XS1_PORT_8D in 8 1 bit ports?
Regards,
Ck
Use 8 bit port for i2c
-
- Active Member
- Posts: 63
- Joined: Sat Oct 15, 2011 8:53 pm
-
- XCore Legend
- Posts: 1126
- Joined: Thu May 27, 2010 10:08 am
I'm afraid your desired bit allocation within the 8b port is not easily doable.
CLK_IN relies on the ability to tie a port to a clock block, which is only possible with 1b ports.
DATA relies on the serialiser which needs to be dedicated to a single pin, which is only possible on 1b port (you can serialise onto a 4b or 8b port, but the data would need unzipping). It needs the serialiser to get the performance up - the xcore only outputs a single 32b word for 32x serial data bits output (very efficient).
I2C is doable on a 4b (or even 8b) port, but with restrictions - it cannot detect the ACK and cannot read. So is OK for blind I2C writes - we do this on the DJ kit (actually writes to 2 * codecs in parallel, which have the same address) . You'll need to use module_i2c_single_port to do this - see app_usb_aud_skc_su1 for details and usage
PS - I notice you submitted this as a Q&A too. Please can you just chose one method of submitting to avoid duplication (Q&A for a small scope question, forum for more complex quetsions/discussions/chat etc.). Thanks :)
CLK_IN relies on the ability to tie a port to a clock block, which is only possible with 1b ports.
DATA relies on the serialiser which needs to be dedicated to a single pin, which is only possible on 1b port (you can serialise onto a 4b or 8b port, but the data would need unzipping). It needs the serialiser to get the performance up - the xcore only outputs a single 32b word for 32x serial data bits output (very efficient).
I2C is doable on a 4b (or even 8b) port, but with restrictions - it cannot detect the ACK and cannot read. So is OK for blind I2C writes - we do this on the DJ kit (actually writes to 2 * codecs in parallel, which have the same address) . You'll need to use module_i2c_single_port to do this - see app_usb_aud_skc_su1 for details and usage
PS - I notice you submitted this as a Q&A too. Please can you just chose one method of submitting to avoid duplication (Q&A for a small scope question, forum for more complex quetsions/discussions/chat etc.). Thanks :)
-
- Active Member
- Posts: 63
- Joined: Sat Oct 15, 2011 8:53 pm
Sorry, was an accident due to the back button on my mouse...infiniteimprobability wrote: PS - I notice you submitted this as a Q&A too. Please can you just chose one method of submitting to avoid duplication (Q&A for a small scope question, forum for more complex quetsions/discussions/chat etc.). Thanks :)
How would I tell the module_i2c_single, that my SDA port is bit 6 and the SCL port is bit 7?
-
- Active Member
- Posts: 35
- Joined: Wed Dec 18, 2013 9:20 pm
Do not know by heart and I am not behind my Laptop ..........
there is a header (i2c.h ???) file saying ....
SCL = 1
SDA = 2
meaning .....
If you wish to assert SCL or SDA write a 1 or 2 to that specific port.
In your case it would become
SDA = 0x80
SCL = 0x40
there is a header (i2c.h ???) file saying ....
SCL = 1
SDA = 2
meaning .....
If you wish to assert SCL or SDA write a 1 or 2 to that specific port.
In your case it would become
SDA = 0x80
SCL = 0x40
-
- XCore Legend
- Posts: 1126
- Joined: Thu May 27, 2010 10:08 am
stdefeber is right - take a look in i2c.h in module_i2c_single_port/src to find this