HOLTEK HT16K33 setting Slave address Progmatically

Use this section to discuss your embedded Flowcode projects.
Post Reply
jay_dee
Posts: 197
http://meble-kuchenne.info.pl
Joined: Sun Dec 20, 2020 6:06 pm
Has thanked: 75 times
Been thanked: 54 times

HOLTEK HT16K33 setting Slave address Progmatically

Post by jay_dee »

Hi,
For the HT16K33 led driver Component, is there a simple way to set the target slave address progmatically?
I have multiple chips each with different Hardware set i2C slave addresses.

I looked inside the initialise routine, as this sets the i2C slave adress for a single device but I'm unsure how to make it such that I can change the target slave address on the fly.
Many thanks, J.

medelec35
Matrix Staff
Posts: 1913
Joined: Wed Dec 02, 2020 11:07 pm
Has thanked: 619 times
Been thanked: 644 times

Re: HOLTEK HT16K33 setting Slave address Progmatically

Post by medelec35 »

Hi Jay.
I have modified the HT16K33 component to hopefully do what you want it to do.

Before the component is added to the component database.
Browse to this location using file explorer , it's hidden by default so just paste the link into your address bar.

Code: Select all

%ProgramData%\MatrixTSL\FlowcodeV10\Components
Place the attached component.
If Flowcode is already open, then you will need to reload your project for the new component to work
If you run any component updates, then the component you added will be overwritten, so it will stop working again (unless the component update has been pushed).

After testing can you let me know how you get on.
Attachments
LEDMatrixHT16K33.fcpx
(14.96 KiB) Downloaded 22 times
Martin

jay_dee
Posts: 197
Joined: Sun Dec 20, 2020 6:06 pm
Has thanked: 75 times
Been thanked: 54 times

Re: HOLTEK HT16K33 setting Slave address Progmatically

Post by jay_dee »

Thanks Martin, that is great. I have PCBs turning up at the end of this week so I'll try in on hardware ASAP and report. J.

medelec35
Matrix Staff
Posts: 1913
Joined: Wed Dec 02, 2020 11:07 pm
Has thanked: 619 times
Been thanked: 644 times

Re: HOLTEK HT16K33 setting Slave address Progmatically

Post by medelec35 »

Excellent, thank you.
I look forward to your feedback.
Martin

jay_dee
Posts: 197
Joined: Sun Dec 20, 2020 6:06 pm
Has thanked: 75 times
Been thanked: 54 times

Re: HOLTEK HT16K33 setting Slave address Progmatically

Post by jay_dee »

Hi, No luck as yet trying to talk to 2 IC's.
Just including the Address change macro causes the whole program to cycle very slowly, like its waiting for some error to timeout. (maybe)

I think another issue might be that each HT16K33 need to be initialised, setting each IC's internal oscillator on.
I've tried to re-create the component initialise macro with manual i2C calls but no luck as yet. J.

jay_dee
Posts: 197
Joined: Sun Dec 20, 2020 6:06 pm
Has thanked: 75 times
Been thanked: 54 times

Re: HOLTEK HT16K33 setting Slave address Progmatically

Post by jay_dee »

So this DIY initialise seems to work for a single IC. With a manually set address 0x71 + Write = 0xE2.
I have to use the Change address macro at the start so this Macro is clearly setting the correct Address to the rest of the FC code.
Init.JPG
Init.JPG (39.72 KiB) Viewed 6185 times
So.. even if the Slave Address is set to another number in the Component Properties, this INIT it still work. Which is good.

If the INIT is run before the min loop, all is Good.
But If I try to run it inside the Main loop, the LED status Blink slows to a glacial crawl and there is no I2C output measured by the scope.

I hoped I could just initiallise each IC every time i wanted to write values to it, that currently does not seem to work. J.

medelec35
Matrix Staff
Posts: 1913
Joined: Wed Dec 02, 2020 11:07 pm
Has thanked: 619 times
Been thanked: 644 times

Re: HOLTEK HT16K33 setting Slave address Progmatically

Post by medelec35 »

Hi J.
Thank you for your feedback.
This is what I did for the ChangeAddress function:
ChangeAddress Function.png
ChangeAddress Function.png (33.47 KiB) Viewed 6181 times
I will revisit this when I can a chance.
Martin

jay_dee
Posts: 197
Joined: Sun Dec 20, 2020 6:06 pm
Has thanked: 75 times
Been thanked: 54 times

Re: HOLTEK HT16K33 setting Slave address Progmatically

Post by jay_dee »

Hi, I have a simplified hardware setup on the bench to remove any possible hardware issues. Just using 2x Adafruit 7 Segments with Holteck Backpacks.
I can write indiviidually to both modules, one is i2C address 0x71 the other is 0x72
However I cannot 'hot-swap' between the two. When I enable the change address macro, the i2C comms is stopped.

Monitoring with the scope, I get the initial setup i2C messages but it does not transmit any of the Change Address i2C commands.
Program is still cyclcing (very slowly) but no further i2C commands are issued.
sevenseg.jpg
sevenseg.jpg (118.6 KiB) Viewed 5830 times
I tried to write my own initiiase for the HOLTEK, whilst this works OK, it does not set the correct Chip address in all of the other Macros so no other command will work.
I dont know how to set the I2C hardware address so that all other macros of the component write correctly with the new address.
HT16K33_Multi_Chip_Test.fcfx
(65.22 KiB) Downloaded 23 times
Any thoughts on other things I can try is appreciated.
J.

jay_dee
Posts: 197
Joined: Sun Dec 20, 2020 6:06 pm
Has thanked: 75 times
Been thanked: 54 times

Flowcode v10 Re: HOLTEK HT16K33 setting Slave address Progmatically

Post by jay_dee »

Hi,
So bit of a marathon 12 hours on this yesterday. I can get multiple HT16K33 IC to talk on the same i2C bus !! Amazing!!
but I have to run the i2C in software mode.
I am using the 'Change address macro' as Supplied by Martin. So this is looking good, in software mode at least.

A)
By default I always use hardware i2C, as I assume this is more efficient/effective/correct ?? if you have a hardware i2C periferal in your PIC. #
After much testing and variation of setups, it will blank refuse to run more than one IC if PIC Periferal i2C is used. Change to software bit bang i2C and bingo.
I am using PIC18F2585
It would be great to understand why this happen but its beyound my technical depth.

B)
Also there is some very odd behaviour if you try to use multiple HT16K33 if one of the IC's is set to the base address of 0x70. I had a far more stable behavior by using 0x71 to 0x76

C) Lastly and it might just have been something dumb I did but I seem to have killed at least on HT16K33 in this process, it now resonds to some bizare i2C address that should not be possible. Could not find the reason why, evntually changing the IC solved that litle problem.
Thanks. J.

medelec35
Matrix Staff
Posts: 1913
Joined: Wed Dec 02, 2020 11:07 pm
Has thanked: 619 times
Been thanked: 644 times

Re: HOLTEK HT16K33 setting Slave address Progmatically

Post by medelec35 »

Hi J.
When I get a chance, I will investigate the issue and see if I can get it all working in non-software mode as well.
Martin

Post Reply